FrontendDeveloper.in

JavaScript question detail

What is the output of below string expression

console.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.

Back to all JavaScript questions
Get LinkedIn Premium at Rs 399