0

Need help in typeof Operator in Javascript

I make a program in JS which will print the type of string but I get an error https://code.sololearn.com/W1GrlUM7B9vq/?ref=app

14th Jun 2020, 5:12 PM
Abdul Samad
1 ответ
+ 3
window.onload=function(){ Js code goes here } Js script gets loaded before html here in sololearn ,so you are accessing a element which doesn't exit yet so hence the innerHTML returns null ,to prevent it windows.onload function let the html Dom get loaded first and then script is executed
14th Jun 2020, 5:19 PM
Abhay
Abhay - avatar