JS - Operators
by anoopsuda
JavaScript
// Arithamatic
// + , - , *, **, / , %
let a = 2;
let b = 3;
console.log(a ** b);
// Assignment Operators
// = , += , -= , *= , /= , %= , **= ,
//Compare Operators
// ==, !=, >, >=, <, <=, ===
// logical operators
// &&, ||, !
//Statements
let x = 10;
if (x > 10){
document.write("x is > to 10");
}
else if (x < 11){
document.write("x is < to 11");
}
else if (x === 12){
document.write("x is nor equels to 10 or 11");
}
// switch
let fruit = 'rose';
switch(fruit) {
case 'apple':
case 'mango':
case 'pineapple':
console.log(`${fruit} is a fruit.`);
break;
default:
console.log(`${fruit} is not a fruit.`);
break;
}