Help substring java script


am currently learning java script. am on lesson 23.
the interperer keeps saying wrong substring for january and am sure the substring is righ. pls helpt


Hi @bitace94944

Show us your code :relaxed:


the code
// 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("Melbourne is great".substring(0,13));


Well your code is rigth, you have to do know what the substring() method extracts between "start" and "end", not including "end" itself.

So in your code


will return


because index[3] of "january" is "u" and it's not include you know ?


Hi buddy ,

I too faced with the same problem and finally solved it !!
Make sure that the 'J in January is uppercase when entered in console.log

Make sure that the 'M' in Melbourne is uppercase when entered in console.log
console.log('Melbourne is great'.substring(0,12));

Make sure that the 'H' in Hamburgers is uppercase when entered in console.log

Follow this and you will successfully complete this substring practice module..

Good Luck!!!


why is "January".substring(0,3); wrong?

These are the instructions:
Using console.log, on three separate lines, print out the substrings for the following strings.

a. "Jan" in "January"