“JS Boolean ()” Kode Jawaban

JS adalah Boolean

if (typeof variable === "boolean"){
  // variable is a boolean
}
Evergreen Tomato

Javascript Boolean

const dataChecked = true;
const valueCounted = false;
SAMER SAEID

fungsi javascript mengembalikan boolean

function  func(){
  return true;
}

isBool = func();
console.log(typeof (isBool));   // output - string


let isBool = func();
console.log(typeof (isBool));   // output - boolean
Code Wrangler

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
Encouraging NeoBliz

Jawaban yang mirip dengan “JS Boolean ()”

Pertanyaan yang mirip dengan “JS Boolean ()”

Lebih banyak jawaban terkait untuk “JS Boolean ()” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya