Javascript Chp 4 Functions and Basic If statements
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
// Function Declaration
function sum(x,y){
// These are arguments
c = x+y;
return c;
}
const a = 60;
const b = 100;
// Function calls
var alpha = sum(600,45);
console.log("The sum is____",sum(a,b));
console.log("This is what i don't know __",c);
console.log("This is alpha ___",alpha);
// "Conditional Statements in Javascript"
console.log("Now,These are the conditional statments_____");
// No.1 - The if-else statements
let age = 16;
if(age>=18) {
console.log("He's an adult","Because the age is greater than or equal than 18");
} else{
console.log("Babua hamaar !!", "Because the age is not greater than 18");
}
// No.2 - The if statements
let yy = 33;
if(yy % 2 === 0){
console.log("The is even my friend")
}
if(yy % 2 !== 0){
console.log("The is not even my friend")
}
</script>
</body>
</html>
Comments
Post a Comment