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)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay