Stuck at substrings


#1

// console.log("January".substring(0,2));

I have no idea why this wouldn't print the first three letters. the message I get is that this is not correct. J is position 0. That would make N position 2.

What is wrong?


#2

Hi @chant30

You have to create a variable what you'll introduce your string

var text = "January";
console.log(text.substring(0,3));

You have to know what the substring() method extracts the characters in a string between "start" and "end", not including "end" itself.


#3

Hi Man,

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
console.log('January'.substring(0,3));

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
console.log('Hamburgers'.substring(3,10));

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

Good Luck!!!