js is boolean
if (typeof variable === "boolean"){
// variable is a boolean
}
js is boolean
if (typeof variable === "boolean"){
// variable is a boolean
}
js Boolean()
// falsy values: false, 0, -0, 0n, null, undefined, NaN, and the empty string ""
console.log(Boolean(false)) // false
console.log(Boolean(0)) // false
console.log(Boolean(-0)) // false
console.log(Boolean(0n)) // false
console.log(Boolean(null)) // false
console.log(Boolean(undefined)) // false
console.log(Boolean(NaN)) // false
console.log(Boolean("")) // false
console.log(typeof Boolean("")) // boolean
// truthy values: true, 1, -1, 1n, -1n, Infinity, -Infinity, " ", {}, []
console.log(Boolean(true)) // true
console.log(Boolean(1)) // true
console.log(Boolean(-1)) // true
console.log(Boolean(1n)) // true
console.log(Boolean(-1n)) // true
console.log(Boolean(Infinity)) // true
console.log(Boolean(-Infinity)) // true
console.log(Boolean(" ")) // true
console.log(Boolean({})) // true
console.log(Boolean([])) // true
console.log(typeof Boolean([])) // boolean
boolean javascript
var a = 2;
var b = 3;
var c = 2;
(a == b) // returns false
(a == c) //returns true
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us