+ 12
do this: window.onload=function(){ var date=new Date() document.body.innerHTML = "<h1>Todays date is"+ date + "</h1>"; }
6th Jan 2018, 3:01 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 12
Yes.
6th Jan 2018, 3:15 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 11
And it is null because the body hasn't loaded yet.
6th Jan 2018, 3:07 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 10
Which code ?
6th Jan 2018, 2:58 PM
Swapnil Srivastava
Swapnil Srivastava - avatar