0
Setinterval
9 Antworten
+ 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.
+ 1
https://code.sololearn.com/WHksf0yb1402/?ref=app
ur saying document.write erases everything before printing but it doesnt here
+ 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()
+ 1
Yeah thx,got it
0
The word "start" disappears
0
Is it a bug?
0
What about this
0
Or i understood wrong?