js === operator code example
Example 1: js different
true != true // => false
Example 2: === javascript
// === means equal value and equal type
var x = 5
// true
x === 5
// false
x === "5"
Example 3: javascript ... operator
//The operator ... is part of the array destructuring.
//It's used to extract info from arrays to single variables.
//The operator ... means "the rest of the array".
var [head, ...tail] = ["Hello", "I" , "am", "Sarah"];
console.log(head);//"Hello"
console.log(tail);//["I", "am", "Sarah"]
//It can be used to pass an array as a list of function arguments
let a = [2,3,4];
Math.max(a) //--> NaN
Math.max(...a) //--> 4
Example 4: ... operator javascript
let a = { a: 0, b: 1 };
let b = { b: 2, c: 3 };
let c = { ...a, ...b };
console.log(c);
output -> {a: 0, b: 2, c: 3}
Example 5: === in js
<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<script>
var x = abc;
document.getElementById("demo").innerHTML = (x === "ABC");
</script>
</body>
</html>