Answers for "is null falsy javascript"

0

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);
Posted by: Guest on December-22-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language