πŸ“Š JavaScript
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
πŸ’¬ Discuss
βœ… Correct Answer: (D) NaN

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

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

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
188
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
89%
Success Rate