Answer the question
In order to leave comments, you need to log in
What does the highlighted line that starts with if do?
//Запускает таймер
function go(){
window.timerId = window.setInterval(timer, 1000);
}
function timer(){
if(window.number == undefined || window.number == 3) {
window.number = 1;
} else window.number = window.number + 1;
var img = document.getElementById('img');
img.src = 'smiles/'+window.number+'.png'
}
Answer the question
In order to leave comments, you need to log in
I think it should be understood like this:
If the property "window.number" does not exist or is equal to 3 ,
then set this property to 1 ,
otherwise add 1 to the existing value .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question