0
How to use between in JavaScript.
Hi sololearner! I was practicing coding and want like example if time is between 7 and 12 o,clock document.write("good morning"); so how can I use it by coding. please help me.....
3 Respostas
+ 3
use Date Object
so example ughhhh
think of if condition for first
if hours between 7 and 12 right?
then code would like hours>7 and hours<12
var d=new Date();//get something that called date object while It's data packed of status
if(d.getHours()>7&&d.getHours()<12)document.write("good morning,Wakanda!!");else document.write("Loki dead :(")
+ 6
Does this help? (The second and the third slide)
https://www.sololearn.com/learn/JavaScript/1244/?ref=app
0
Thanks I get it as you explained, using && is the solution!