Knowee
Questions
Features
Study Tools

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?

Options:

  • 0 (number)
  • true (boolean)
  • [] (empty array)
  • "false" (string)
🧐 Not the exact question you are looking for?Go ask a question

Solution

In JavaScript, falsy values are values that evaluate to false when coerced to a boolean. The following values are considered falsy:

  1. false (boolean)
  2. 0 (number)
  3. "" (empty string)
  4. null
  5. undefined
  6. NaN

Now, let's evaluate the options provided:

  1. 0 (number): This is a falsy value.
  2. true (boolean): This is a truthy value.
  3. [] (empty array): An empty array is considered a truthy value in JavaScript.
  4. "false" (string): This string is considered a truthy value because any non-empty string is truthy.

Final Answer

The falsy value among the options is 0 (number).

This problem has been solved

Similar Questions

Which of the following is not a primitive data type in JavaScript?Group of answer choicesNumberStringBooleanArray

Which of these values can a boolean variable contain?Options0 & 1true & falseAny integer valuetrue

What is the default value of boolean?Options: Pick one correct answer from belowtruefalse

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

An array is a reference to multiple variables. State true or false.a)Falseb)True

1/2

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.