JavaScript if Else
-------------------------------------------index.html -----------------------------------------------
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>This is tutorial </h1>
</body>
<script src="Script.js"></script>
</html>
---------------------------------- Script.js ----------------------------------------
console.log('this is tutorial for if else condition');
const age = 55;
if(age==55)
{
console.log('Age is 55')
}
else if(age == 30) {
console.log('age is 30')
}
else {
console.log('age is not 28')
}
Comments
Post a Comment