Plz help 26 lesson


#1

// On line 2, declare a variable myName and give it your name.
var myName "Rishabh";
// On line 4, use console.log to print out the myName variable.
console.log("myName");
// On line 7, change the value of myName to be just the first 2
// letters of your name.
myName = "myName".substring(0,2);
// On line 9, use console.log to print out the myName variable.
console.log("myName")

What is wrong


#2

You are putting " " on your variable - don't do that. Only use quotes on strings, for example, "Rishabh".

    console.log("myName");  // will print myName
    console.log(myName); // will print Rishabh

#3

so what is the code then ?


#4

I'm sorry, I thought that my example explained that. :smile:

Here you go, this is your line 4:

    console.log(myName);

Make the same change for the substring and the second console.log lines.


#5

// On line 2, declare a variable myName and give it your name.
var myName = "Rishabh"
// On line 4, use console.log to print out the myName variable.
console.log(myName)
// On line 7, change the value of myName to be just the first 2
// letters of your name.
myName = "myName".substring(0,2);
// On line 9, use console.log to print out the myName variable.

console.log(myName);


#6

NO quotes on variables! :smile:


#7

why did we use substring it says change value of name to just to so according to that myName = "Ris"


#8

We are learning to use substring so that we can pick out parts of strings.

When you do it correctly, the final console.log should print "Ri".