Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

operators in js

//Logical Binary and Ternary Operators in Javascript

== Equal to
=== Strictly equal to
!= Not equal to
!== Strictly not equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to

&& Logical and
|| Logical or
! Logical not

? Ternary operator
Comment

JS basic operators

// Math Operators
const now = 2022;
const age1 = now - 1994;
const age2 = now - 2000;

console.log(age1 * 2, age1 / 10, 2 ** 3);
// 2 ** 3 = 2 * 2 * 2

// Assigment Operators
let x = 10 + 5; //15

x += 10; // x = x + 10 = 25
x *= 4; // x = x * 4 = 25 * 4 = 100
x /= 5; // x = x / 5 = 100 / 5 = 20
x++; // x = x + 1
x--; // x = x - 1

// Comparison Operators
const isFullAge = age2 >= 18;
Comment

JavaScript Operators

var x = 5;         // assign the value 5 to x
var y = 2;         // assign the value 2 to y
var z = x + y;     // assign the value 7 to z (5 + 2)
Comment

JavaScript Operators

let x = 5;         // assign the value 5 to x
let y = 2;         // assign the value 2 to y
let z = x + y; 
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript check if visible 
Javascript :: sort numbers in javascript 
Javascript :: post request javascript 
Javascript :: jquery datepicker 
Javascript :: react semantic button 
Javascript :: ref in functional components 
Javascript :: jquery on multiple events 
Javascript :: iife in javascript 
Javascript :: javascript function to strikethrough text 
Javascript :: classic asp get json from url 
Javascript :: serializeobject jquery 
Javascript :: comparing two array of objects in javascript returning differences 
Javascript :: jquery remove multiple class 
Javascript :: Redux thunk and react redux 
Javascript :: concat strings shopify liquid 
Javascript :: webpack build watch 
Javascript :: prevstate in react 
Javascript :: javascript base64 to length 
Javascript :: convert milliseconds to time javascript 
Javascript :: feet to cm javascript 
Javascript :: how to get a due date from current date in javascript 
Javascript :: multiple styles in react native 
Javascript :: local reload go to top 
Javascript :: how to add options to select in jquery array 
Javascript :: javascript press tab key 
Javascript :: add to a list mongoose 
Javascript :: react fragment inside map with key prop 
Javascript :: react chat sheet 
Javascript :: javascript check if in array 
Javascript :: javascript on enter key searchbox 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =