Answers for "how to write a program that tests whether it's before noon and alert “Its AM” else “its PM” in javascript"

0

how to write a program that tests whether it's before noon and alert “Its AM” else “its PM” in javascript

var a = new Date();
var b = a.toString();
var c = b.slice(16,19);
if (c === "12:"){
    document.write("It's PM")
}else if(c === "13:"){
    document.write("It's PM")
}else if(c === "14:"){
    document.write("It's PM")
}else if(c === "15:"){
    document.write("It's PM")
}else if(c === "16:"){
    document.write("It's PM")
}else if(c === "17:"){
    document.write("It's PM")
}else if(c === "18:"){
    document.write("It's PM")
}else if(c === "19:"){
    document.write("It's PM")
}else if(c === "20:"){
    document.write("It's PM")
}else if(c === "21:"){
    document.write("It's PM")
}else if(c === "22:"){
    document.write("It's PM")
}else if(c === "23:"){
    document.write("It's PM")
}else if(c === "24:"){
    document.write("It's AM")
}else if(c === "01:"){
    document.write("It's AM")
}else if(c === "02:"){
    document.write("It's AM")
}else if(c === "03:"){
    document.write("It's AM")
}else if(c === "04:"){
    document.write("It's AM")
}else if(c === "05:"){
    document.write("It's AM")
}else if(c === "06:"){
    document.write("It's AM")
}else if(c === "07:"){
    document.write("It's AM")
}else if(c === "08:"){
    document.write("It's AM")
}else if(c === "09:"){
    document.write("It's AM")
}else if(c === "10:"){
    document.write("It's AM")
}else if(c === "11:"){
    document.write("It's AM")
}
Posted by: Guest on June-21-2020

Code answers related to "how to write a program that tests whether it's before noon and alert “Its AM” else “its PM” in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language