Question:

Which of the following value will return from given JavaScript statement? isNaN(123);

Show Hint

The isNaN() function returns true only when the value cannot be converted into a valid number.
  • true
  • false
  • yes
  • no
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Step 1: Understand the isNaN() function.

In JavaScript, isNaN() is a built-in function used to check whether a value is "Not-a-Number". If the value passed to this function is not a number, the function returns true. If the value is a valid number, the function returns false.

Step 2: Evaluate the given statement.

The statement given in the question is:

isNaN(123);
Here, the value 123 is clearly a numeric value.

Since 123 is a valid number, it is not NaN (Not-a-Number).

Step 3: Determine the result.

Because the value is a valid number, the function returns false.

Example:

isNaN("Hello")  → true
isNaN(123)      → false
Step 4: Conclusion.

Therefore, the JavaScript statement isNaN(123) returns false.
Was this answer helpful?
0
0