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

? operator in js

? call ternary operator is shorcut for, "if statement".
// below we make object with key id, and assign it a value from body.id.
// if body.id is null it will return false and it will assign it res.id value.
{ id: body.id? body.id : res.id }
// we can write it in if statement like this
if(body.id){
 return {id:body.id}
}else{
  return {id:res.id}
}
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 :: next js custom document 
Javascript :: add items to a react array in hooks 
Javascript :: axios post request 
Javascript :: js add html element 
Javascript :: get key for value javascript 
Javascript :: sliding window algorithm javascript 
Javascript :: Factorialize a Number 
Javascript :: how to install nuxtjs with tailwind css 
Javascript :: vuejs transform observer to object 
Javascript :: angular ionic capacitor nfc reader 
Javascript :: select the items from selectors in .map reactjs 
Javascript :: anjular js 
Javascript :: use inline and other styles react native 
Javascript :: destructuring objects 
Javascript :: node check if internet 
Javascript :: ajax is not a function 
Javascript :: move last element of array to begining javascript 
Javascript :: angular right click action 
Javascript :: context api react 
Javascript :: MaterialStateProperty width 
Javascript :: angular get name of component 
Javascript :: javascript array.from 
Javascript :: run jest test for a single file 
Javascript :: pass data to slot vue 
Javascript :: TypeError: navigation.getParams is not a function. 
Javascript :: body-parser is depreciated 
Javascript :: js changing selected option by index 
Javascript :: import in react js 
Javascript :: path module js 
Javascript :: call python function from javascript 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =