Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

logic 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

How does logical operators or || works in javascript?

const num = 6;
if (num <= 4 || num <= 8) {
    console.log('true')
} else {
    console.log('false')
}
//Expected output:true
Comment

Logical Operators in JavaScript

// logical AND
console.log(true && true); // true
console.log(true && false); // false

// logical OR
console.log(true || false); // true

// logical NOT
console.log(!true); // false
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript get tag child elements 
Javascript :: array as json 
Javascript :: js maths 
Javascript :: jason in javascript 
Javascript :: get second element with a class jquery 
Javascript :: Date toLocaleDateString Javascript 
Javascript :: js random unique id 
Javascript :: get json data into object 
Javascript :: javascript get current window location without parameters 
Javascript :: jquery onlcikc css 
Javascript :: validate form on submit 
Javascript :: jquery close 
Javascript :: JSON parse error: Cannot deserialize value of type `java.time.LocalDateTime` from String 
Javascript :: node assert 
Javascript :: useformik 
Javascript :: jquery replicate div on drag 
Javascript :: prev props 
Javascript :: remove falsy values from array with lodash 
Javascript :: how to create react native app 
Javascript :: javascript add id to element with class 
Javascript :: closure and scope javascript 
Javascript :: Uncaught (in promise) DOMException: Failed to load because no supported source was found. 
Javascript :: getting the value of pi in javascript 
Javascript :: Get specific route vuejs 
Javascript :: how to read json file with file input html 
Javascript :: jquery dynamic event binding 
Javascript :: how to make first letter uppercase in javascript 
Javascript :: javascript round .5 down 
Javascript :: find class 
Javascript :: remove substring from string liquid shopify 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =