0

how to fix this error in it

var x, y; x=1024; y=x x="foobar"; document.write("x="+ y +"<br>"); document.write("x="+x); var greeting; var time=new date().gethours(); if(time<10){ greeting="Good morning"; }else if(time<20){ greeting="Good day"; }else{ greeting="Good evening" } document.getelementbyid("demo").innerhtml=greeting; }

21st Oct 2019, 6:33 PM
Ako Rashid
Ako Rashid - avatar
6 Réponses
+ 1
var x, y; x=1024; y=x; x="foobar"; //inserted semi-colon document.write("x="+ y +"<br>"); document.write("x="+x); var greeting; var time=new Date().getHours; //date -> Date and gethours -> getHours if(time<10){ greeting="Good morning"; }else if(time<20){ greeting="Good day"; }else{ greeting="Good evening" } document.getElementById("demo").innerHTML=greeting; //corrected non-capitalisation // removed extra "}" It's very important to get the right capitalisation in all methods.
21st Oct 2019, 7:03 PM
Russ
Russ - avatar
+ 1
thanks 3boood
21st Oct 2019, 7:41 PM
Ako Rashid
Ako Rashid - avatar
+ 1
many thanks Ipang we solved thank you
22nd Oct 2019, 1:21 PM
Ako Rashid
Ako Rashid - avatar
0
You forget semicolon in line 3 After y=x ; I think you have to delete the last chraecter ( } ) in the last line Then run the code ...
21st Oct 2019, 7:07 PM
Abdulmalek Mohammed Jayash
Abdulmalek Mohammed Jayash - avatar
0
many thanks Russ
21st Oct 2019, 7:40 PM
Ako Rashid
Ako Rashid - avatar
0
I wonder how your question is displayed without any Relevant Tags.
22nd Oct 2019, 8:15 AM
Ipang