DEV Community

Cover image for What does this JavaScript code log and why?
Codeguage
Codeguage

Posted on

What does this JavaScript code log and why?

Q. What does the following code log?

var s = 'Good';
s[0] = 'F';

console.log(s);
Enter fullscreen mode Exit fullscreen mode

Why is the output what it is?

Top comments (0)