Which of the following is a falsy value in JavaScript?Options0 (number)true (boolean)[ ] (empty array)"false" (string)
Question
Which of the following is a falsy value in JavaScript?Options0 (number)true (boolean)[ ] (empty array)"false" (string)
Solution 1
The falsy value in JavaScript from the given options is 0 (number).
In JavaScript, a falsy value is a value that is considered false when encountered in a Boolean context. JavaScript uses type coercion in Boolean contexts.
Here are all the falsy values in JavaScript:
- false
- 0 and -0
- '' and "" (empty string)
- null
- undefined
- NaN
So, from the given options, 0 (number) is the falsy value.
Solution 2
The falsy value in JavaScript from the given options is 0 (number). In JavaScript, a falsy value is a value that is considered false when encountered in a Boolean context. JavaScript uses type coercion in Boolean contexts.
Here are all the falsy values in JavaScript:
- false
- 0 and -0
- '' and "" (empty string)
- null
- undefined
- NaN
So, from the given options, 0 (number) is the falsy value.
Similar Questions
Which of the following is not a primitive data type in JavaScript?Group of answer choicesBooleanStringNumberArray
Which of these values can a boolean variable contain?Options0 & 1true & falseAny integer valuetrue
Which of the following is a valid JavaScript variable data type?1.0 MarksInteger, Float, Double, CharacterString, Number, Boolean, Null, UndefinedBoolean, Undefined, Null, FunctionString, Number, Array, Object
Which function returns "TRUE" only if all its arguments are "TRUE"?Options NOT AND IF OR
What is the output of following code?var a = 10;function test() { a = 20;}test();console.log(a);Options: Pick one correct answer from below1020
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.