- 1
I cannot figure out why it turns back to default after the code is done.
Black background white text, turns back white and black text. Run it yourself. https://code.sololearn.com/WH2CXGg43Js3/?ref=app
2 Answers
+ 6
The reason why everything is getting reset is because the document.write function will automatically clear your entire screen when using it. What I would suggest doing instead is pushing the text into an element rather than just using that function (one of the ways you could do that is by replacing document.write(... to document.body.innerHTML = num+' Doubled is: '+a+''; )
- 1
Thank you