Can anyone solve this problem the clock is not rotating... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone solve this problem the clock is not rotating...

https://code.sololearn.com/WGbwHtV3Xki5/?ref=app

6th Apr 2020, 7:51 AM
Sai Dinesh
Sai Dinesh - avatar
2 Answers
0
The directly related problem is that you assign 'window' object but you need to assign its 'onload' event handler: window.onload = () => {} ... or shorter, only 'onload' because window is the global object (as ypu do for 'setInterval' wich is a window method) and is always scope accessible, until you've declared variable with name conflict ('onload' here) in the actual scope (or parent scope)... Second, you'll be better advised to specify a delay to your setInterval call... if not, the callback is run approximativelly every 3ms.: in your case, update the clock a few more than one time every 1 sec. should be enough to avoid delay artefacts (300ms sounds good to me). The real secondary problem is how you build your html clock structure: if you run your code now that js problem is fixed, click needles are rotating, but not as you expect... So, a code is shorter than a descriptions of changes to make in your css to fix this: https://code.sololearn.com/W31hjrXEaGuN/?ref=app
6th Apr 2020, 11:13 AM
visph
visph - avatar
0
Tq so much bro...
6th Apr 2020, 1:35 PM
Sai Dinesh
Sai Dinesh - avatar