| 21 | } |
| 22 | |
| 23 | function setminute() { |
| 24 | const now = new Date(); |
| 25 | |
| 26 | const minutes = now.getMinutes(); |
| 27 | const m = ((minutes*6)-90); |
| 28 | console.log(m); |
| 29 | |
| 30 | |
| 31 | minutehand.style.transform = `rotate(${m}deg)`; |
| 32 | |
| 33 | //using properties that have : , :is replaced by = and than the ahead part comes in backticks |
| 34 | //whenever you are writing a varible const use ${} and whenever you use ${} you must use `` backtics (i.e esc down button) to close your brackets |
| 35 | // how to change the class of an elemt by js , make that new class in css and use elementconstname.classList.add('newstyleclassname'); |
| 36 | |
| 37 | } |
| 38 | |
| 39 | setInterval(setdate,1000); |
| 40 | setInterval(setminute,1000); |