Commit d82e8fd3 authored by MohammadAli Keshavarz's avatar MohammadAli Keshavarz

Boolean logic

parent e97d860f
......@@ -101,7 +101,7 @@ console.log(x);
/*****************************
* If / else statements
*/
/*
var firstName = 'John';
var civilStatus = 'single';
if (civilStatus === 'married') {
......@@ -126,3 +126,22 @@ if (BMIMark > BMIJohn) {
} else {
console.log('John\'s BMI is higher than Marks\'s.');
}
*/
/*****************************
* Boolean logic
*/
var firstName = 'John';
var age = 20;
if (age < 13) {
console.log(firstName + ' is a boy.');
} else if (age >= 13 && age < 20) {
console.log(firstName + ' is a teenager.');
} else if (age >= 20 && age < 30) {
console.log(firstName + ' is a young man.');
} else {
console.log(firstName + ' is a man.');
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment