Please login to start chat

ICT Solutions 22 Jun 2022, 18:01:25
Category : JavaScript Tutorials

If (JS Statement)

<!DOCTYPE html>
<html>
<head>
<title>JavaScript Statement</title>
</head>
<body>
<h1>JavaScript Code Testing</h1>
<p id = "demo1"></p>
<p id = "demo2"></p>
<p id = "demo3"></p>
<button type = "button" onclick = "jsFunction()">Try Now</button>
<script>
function jsFunction(){
var you = "I like to swim.";
var me = "I like to swim.";
var youme = "Our hobby is not same.";
if (you == me){
document.getElementById("demo1").innerHTML = you;
document.getElementById("demo2").innerHTML = me;
}else{
document.getElementById("demo3").innerHTML = youme;
}
}
</script>
</body>
</html>

Comments:

No comment to show.

Available Services
Download Android Application