"You didn't select the right substring from 'January'."


#1

Hi,
It says that: "Oops, try again. You didn't select the right substring from 'January'." It also prints to the white window only burger text.

// Use console.log( ) to print out the substrings.
// Here is an example of the 1st to 4th letter of "JavaScript":
// console.log("JavaScript".substring(0,4));
"January".substring(0,2);
"Melbourne is great".substring(0,11);
"Hamburgers".substring(3,9);

Isn't J=0, A=1,N=2,U=3,A=4,R=5,Y=6 in this word? So if I want to print only Jan from that word I put like I did on the code?


#2

With substring(x, x) it goes from (and including) the letter you specify, up to (and excluding) the letter you specify. You just need to change the second number to 3 (because it goes up to the second number, not including it.)


#3

Ok, now I got it right.

// Use console.log( ) to print out the substrings.
// Here is an example of the 1st to 4th letter of "JavaScript":
// console.log("JavaScript".substring(0,4));
console.log("January".substring(0,3));
console.log("Melbourne is great".substring(0,12));
console.log("Hamburgers".substring(3,10));

#4

Well done, do you understand now?


#5

Yes I do understand.