javascript falsy values
the number 0
the BigInt 0n
the keyword null
the keyword undefined
the boolean false
the number NaN
the empty string "" (equivalent to '' or ``)
javascript falsy values
the number 0
the BigInt 0n
the keyword null
the keyword undefined
the boolean false
the number NaN
the empty string "" (equivalent to '' or ``)
falsy javascript
//The 6 Falsy values:
false
0
""//empty strings
undefined
null
NaN
is null falsy javascript
/*
Yes.
Full list of falsy values:
Anything evaluated to be 0
'', "", or ``
null
undefined
NaN
Obviously false
Big integers relative to 0n
-------------------------------------------------------------------------
To clarify, line 31 will print false.
*/
var someCheckIsTrue = false;
const checks = [
0,
'',
"",
``,
null,
undefined,
NaN,
false,
0n
];
for (const check of checks) {
if (check) {
someCheckIsTrue = true;
}
}
console.log(someCheckIsTrue);
javascript truthy
// Truthy values:
// All values are truthy, BUT (excluding) the following:
0
''
undefined
null
NaN
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