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);
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);
js convert truthy
!!"" // false
!!0 // false
!!null // false
!!undefined // false
!!NaN // false
!!"hello" // true
!!1 // true
!!{} // true
!![] // 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