0

Setinterval

20th Jan 2022, 4:09 PM
return 0;
return 0; - avatar
9 ответов
+ 2
No it's not document.write() erases everything that was on the page (including that word "start") before it prints whatever argument was given.
20th Jan 2022, 4:37 PM
Ipang
+ 1
https://code.sololearn.com/WHksf0yb1402/?ref=app ur saying document.write erases everything before printing but it doesnt here
20th Jan 2022, 5:50 PM
return 0;
return 0; - avatar
+ 1
In your first code, the word "start" was printed on the page as the document was loaded, and it happens one time only. And then setInterval() is invoked to schedule a call to pr() function once every 3 seconds. The "hello world" text are printed after the document loading phase completed, and that's why the "start" text was deleted. In your second code, both text are printed during the document loading phase, and that's why "start" text is not erased. Whatever was there after page load phase completed will be erased by a call to document.write()
20th Jan 2022, 6:10 PM
Ipang
+ 1
Yeah thx,got it
20th Jan 2022, 7:41 PM
return 0;
return 0; - avatar
0
The word "start" disappears
20th Jan 2022, 4:09 PM
return 0;
return 0; - avatar
20th Jan 2022, 4:10 PM
return 0;
return 0; - avatar
0
Is it a bug?
20th Jan 2022, 4:10 PM
return 0;
return 0; - avatar
0
What about this
20th Jan 2022, 5:50 PM
return 0;
return 0; - avatar
0
Or i understood wrong?
20th Jan 2022, 5:50 PM
return 0;
return 0; - avatar