Analog Clock with only HTML, CSS & JS - Interview Question

preview_player
Показать описание
Analog clocks are a common question you can get in interviews. In this video, I show you how to build one with just HTML, CSS & JS, and we learn a couple of tips here.

_____

🌟 About Me:
Dillion Megida, creator of DEEECODE, is a Software Engineer, Developer Advocate and a Content Creator passionate about simplifying topics around Tech via articles and videos.

_____

⚡️ Connect with me:
Рекомендации по теме
Комментарии
Автор

This is amazing. Let’s continue working on interview questions

bellohakeem
Автор

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.

_aboobae
Автор

360/12 = 30 || 360/60 = 6 ----> is alweys const, u dont need calculate this every 1s
and lite tip : transform-origin: bottom center; <-- second parameter and no more issues with positioning

nicon