operators javascript code example
Example 1: jquery get version
jQuery().jquery;
Example 2: or operator in javascript
var a = true;
var b = false;
if(a || b) {
}
Example 3: javascript operators
Operator Example Same As
= x = y x = y
+= x += y x = x + y
-= x -= y x = x - y
*= x *= y x = x * y
/= x /= y x = x / y
%= x %= y x = x % y
**= x **= y x = x ** y
Example 4: less than equal to in javascript
| <= | less than or equal to | x <= 8 | true |
Example 5: javascript ... operator
var [head, ...tail] = ["Hello", "I" , "am", "Sarah"];
console.log(head);
console.log(tail);
let a = [2,3,4];
Math.max(a)
Math.max(...a)
Example 6: and operator in javascript
var a = true
var b = ""
var c = 1
true && ""
"" && 1
false && 5