homework#5
Conversation
|
|
||
| for (let i=0; i<list.length; i++){ | ||
| list[i].classList.add("list-item") | ||
| } |
There was a problem hiding this comment.
It is perfectly fine as it is. Personal preference for loops is .forEach. I try to avoid for loops because you cannot understand straight away what is going on
| s = checkTime(s); | ||
| document.getElementById('txt').innerHTML = | ||
| h + ":" + m + ":" + s; | ||
| var t = setInterval(showCurrentTime, 500); |
There was a problem hiding this comment.
setInterval needs to be called only once. This line can live outside of this function. Also you can omit t assignment since you don't use it later on
| </script> | ||
| </head> | ||
|
|
||
| <body onload="showCurrentTime()"> |
| console.log(distance); | ||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
no need to leave so many lines as space. One should be enough in most cases
| image.style.left = `${distance}px`; | ||
| distance += 10; | ||
| console.log(image); | ||
| console.log(distance); |
There was a problem hiding this comment.
finalized code should not have any console.log statements. If you want to explain something in your code, try adding some comments
| @@ -0,0 +1,44 @@ | |||
|
|
|||
| let image; | |||
There was a problem hiding this comment.
This variable should not be there. If I remember correctly you placed image here so you can view it from chrome devTools console. This should not be the case. If you want to view something in the console, you can just console.log if at the right place
Co-Authored-By: Nikos Kleidis <nikoskleidis@gmail.com>
No description provided.