If Else Statement tutorial in JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>If Else Statement</title>
<script>
var x = 15;
var y = 100;
var gender = "Male";
var name = "JavaScript";
if (x > 30) {
document.write("x is Greater<br><br>");
}
else {
document.write("x is Smaller<br><br>");
}
if (y == 100) {
document.write("y is Same<br><br>");
}
else {
document.write("y is not Same<br><br>");
}
if (y === "100") {
document.write("y's data type also same<br><br>");
}
else {
document.write("y's data type not same<br><br>");
}
if (gender == "Male") {
document.write("Hello Mr." + name);
}
else {
document.write("Hello Miss." + name);
}
</script>
</head>
<body>
</body>
</html>
.png)
.png)
.png)
.png)
Comments
Post a Comment