A

Admin • 833K Points
Coach

Q. What is the output of this code?

Code:
let name = 'MCQ';
name[0] = 'X';
console.log(name);
  • (A) XCQ
  • (B) MCQ
  • (C) undefined
  • (D) Error
  • Correct Answer - Option(B)
  • Views: 23
  • Filed under category JavaScript
  • Hashtags:

Explanation by: Admin

Strings are immutable in JavaScript; indexing does not allow reassignment.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.