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 :: children javascript 
Javascript :: passport jwt npm 
Javascript :: axios post request with authorization header and body 
Javascript :: working with json in javascript 
Javascript :: javascript getters and setters 
Javascript :: call multiple functions onclick react 
Javascript :: async foreach 
Javascript :: fetch json data into array 
Javascript :: Could not resolve project :react-native-iap mergedebugassets 
Javascript :: Como saber se existe um atributo em um objeto 
Javascript :: how to pass basic auth for api in angular 11 
Javascript :: validate email or phone js 
Javascript :: numberformat react phone number 
Javascript :: javascript import 
Javascript :: ngfor only x item 
Javascript :: delete folder with deno 
Javascript :: javascript move array element to front 
Javascript :: react native gif dont work 
Javascript :: javascript statement 
Javascript :: dynamic button click event in jquery 
Javascript :: The anchorEl prop provided to the component is invalid. 
Javascript :: js nuxt read/set cookie 
Javascript :: javascript arr.flat 
Javascript :: get local year in js 
Javascript :: Vue JS Production mode refresh causing 404 error 
Javascript :: electron load index.html 
Javascript :: javascript change select element 
Javascript :: Appending the option element using jquery each function 
Javascript :: tostring js 
Javascript :: js highest number in array 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =