“logische Operatoren in JavaScript” Code-Antworten

JavaScript logische Operatoren

Operator	Description	Example
&&	Logical AND: true if both the operands are true, else returns false	x && y
||	Logical OR: true if either of the operands is true; returns false if both are false	x || y
!	Logical NOT: true if the operand is false and vice-versa.	!x
SAMER SAEID

weniger als oder gleich JavaScript

if(a <= 5){
   yourFunction();
}
Dr. Hippo

logische Operatoren in JavaScript

n1 = !true               // !t returns false (the opposite of true)
n2 = !false              // !f returns true (the opposite of false)
n3 = !''                 // !f returns true (in JavaScript, an empty string is falsey, thus the opposite of a falsey value here is truthy.)
n4 = !'Cat'              // !t returns false (non empty string is truthy, thus opposite is falsy)
deejay

Logische Operatoren 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
SAMER SAEID

Ähnliche Antworten wie “logische Operatoren in JavaScript”

Fragen ähnlich wie “logische Operatoren in JavaScript”

Weitere verwandte Antworten zu “logische Operatoren in JavaScript” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen