operator precedence

 


Operators

unary, binary, ternary

 

// Unary

let b = -a

 

// Binary Operator


// Arithmetic Operators
let a = b + c

b - c
b + c
b / c


// Comparison Operators
80 < 20
// false

10 < 40
// true

2 >= 2
// true


// Assignment Operator =
const number = 20

 

// Ternary Operator

const score = 80
const scoreRating = score > 50 ? "Good" : "Poor"

// "Good"

 


 
== and ===

Loose Equality ==

== does type  type coercion before comparison

 

Strict Equality ===

=== does not do type coercion before comparison

 

 

Logical operators

 

Conditionals: if

 

Conditionals: switch