Answers for "javascript boolean object return string"

1

convert object to boolean javascript

// bool will be false if object is null, false, 0, etc.
// bool will be true if object is an array, object, non-zero number, etc.

// method 1
let bool = !!object;

// method 2
let bool = Boolean(object);
Posted by: Guest on June-13-2021
0

javascript function return boolean

function  func(){
  return true;
}

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


let isBool = func();
console.log(typeof (isBool));   // output - boolean
Posted by: Guest on June-28-2020

Code answers related to "javascript boolean object return string"

Code answers related to "Javascript"

Browse Popular Code Answers by Language