You should have done was to use the DRY method on the covertToDegree function 360/x, since x is changeable, he should have passed it through the function call, thereby using one function Eg. Const a = (constantTime, currentTime) =>{ Const degree = 360/constantTime * current Time Return degree } Then call them like Const hours = a(12, currentHours) Const minutes = a(12, currentMinutes) Const seconds = a(12, currentSeconds) Making the code less redundant.
This is amazing. Let’s continue working on interview questions
I love this, thank you for sharing
love this
You should have done was to use the DRY method on the covertToDegree function
360/x, since x is changeable, he should have passed it through the function call, thereby using one function
Eg.
Const a = (constantTime, currentTime) =>{
Const degree = 360/constantTime * current Time
Return degree
}
Then call them like
Const hours = a(12, currentHours)
Const minutes = a(12, currentMinutes)
Const seconds = a(12, currentSeconds)
Making the code less redundant.
Thanks
360/12 = 30 || 360/60 = 6 ----> is alweys const, u dont need calculate this every 1s
and lite tip : transform-origin: bottom center;
For code readability, it is necessary to indicate 360/12 but for efficiency you are right, he should have commented 360/x for readability.
First to comment
Now do it without JS
Thanks