Then what is wrong with these


#1

Then what is wrong with these :

console.log("January".substring(0,4));
console.log("Melbourne is great".substring(0,12));
console.log("Hamburgers".substring(3,10));

I am getting : error: Unspecified error.


23 More substring practice
#2

    Two Things,
  • The instructions don't ask you to use substring

  • Substring is used for objects, which this code is lacking.

If you could link the exercise, I could explain even further what the instructions are asking,

Edit: For further reading on substring, refer to the MDN's page on it


#3

Actually, contrary to what rhyscrypto said, chahel is being asked to use substrings. They return a subset of a string between one index and another -- which chahel is definitely not lacking. :blush:

This is from section 23, More Substring Practice, of JavaScript's Getting Started with Programming.

Chahel, the exercise asks for the first three letters of January, you provide four letters by telling it to start cutting off after "u" while it should start cutting off after "n"

J = 0
a = 1
n = 2
u = 3
a = 4.

This may be your error but you should receive more than "unspecified." If you still receive an unspecified error after fixing your code, reset your code by clicking "reset code" and try again.


#5

Thank you for the catch, I don't remember using substring at all in the exercises :confused:


#6

Hi
I started a new session today and all worked out fine.
Thanks for your reply.


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.