26.change variable values


#1


https://www.codecademy.com/en/courses/getting-started-v2/4/3?curriculum_id=506324b3a7dffd00020bf661#


Replace this line with your code. 
// On line 2, declare a variable myName and give it your name.
var myName = "Jinglo"
// 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.
console.log(Jinglo.substring(0,2));
// On line 9, use console.log to print out the myName variable.
console.log("myName");


#2

Hi @arianator10,

To start of with, these two things are not the same:

myName // a variable that is currently set to "Jinglo"
"myName"  // a string consisting of the letters "myName"

#3

If you console.log the myName variable, you don't need to put it in "" as it's not a string.

console.log(myName);

should do it :slight_smile:


#4

Thanks. That really helped! :smile:


#5

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