DEV Community

Siddharth Kanojiya
Siddharth Kanojiya

Posted on • Edited on

JavaScript Operators and Expressions | JavaScript #5

Expression and Conditionals

Airthmetic Operators

let a = 10;
let b = 4;
console.log("a + b = ",a + b)
console.log("a - b = ",a - b)
console.log("a / b = ",a / b)
console.log("a * b = ",a * b)
console.log("a ** b = ",a ** b)
console.log("a % b = ",a % b)
console.log("a++ = ",a++)
console.log("++a = ",++a)
console.log("a-- = ",a--)
console.log("--a = ",--a)
console.log("a = ", a)

// Assignment Operater
let assignment = 1;
assignment += 5
console.log(assignment) // same as assigment = assignment + 5
console.log(assignment)

Comparison Operator
let comp1 = 6;
let comp2 = 7;
console.log("comp1 == comp2 is ", comp1 == comp2)
console.log("comp1 1= comp2 is ", comp1 != comp2)
console.log("comp1 === comp2 is ", comp1 === comp2)
console.log("comp1 !== comp2 is ", comp1 !== comp2)
console.log("comp1 > comp2 is ", comp1 > comp2)

// // Logical Operaters
let x = 5;
let y = 6;
console.log(x<y && x==5)
console.log(x<y || x==5)
// console.log(!fale)
// console.log(!true)

Top comments (0)