JS Coding Questions Logo
JS Coding Questions
#338💼 Interview💻 Code

What is the output of below string expression

Advertisement

728x90
javascript
1console.log("Welcome to JS world"[0]);

The output of the above expression is "W".

Explanation: The bracket notation with specific index on a string returns the character at a specific location. Hence, it returns the character "W" of the string. Since this is not supported in IE7 and below versions, you may need to use the .charAt() method to get the desired result.

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 81

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
338of476