What will be the value of out after executing the code?
var msg = "Welcome to Quizful"; 
var out = msg.substr(3, 3);
Explanation
JavaScript String substr() Method extract a part of the string, starting at the character at the specified position and returns the specified number of characters.
Example:
var string = "quizful";
var newString = string.substr(0,4);
console.log(newString); // will print "quiz" to console.

@Vadim_Klimets Thanks!

2017 May 18, 12:26:24 AM

A semicolon '';" is missing after console.log(newString).

2017 Apr 30, 12:05:19 PM

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback