A

Admin • 828.03K Points
Coach

Q. Consider the following code snippet
let x=x+1;
console.log(x);
What will be the result for the above code snippet?

  • (A) 0
  • (B) Null
  • (C) ReferenceError
  • (D) NaN
  • Correct Answer - Option(D)
  • Views: 13
  • Filed under category JavaScript
  • Hashtags:

Explanation by: Admin
Since x is a let variable and since x is undefined, so x+1 is NaN. Thus, the above code snippet prints NaN.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.