I'm very confused on 26/28


#1

I understood just about everything up to this point. I'm getting an error saying, "It looks like you didn't log your whole name to the console.

Here is my code so far:

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

I'm getting "Ben" from my console log.


#2

There's no need for the brackets, we just want to assign a string to the variable like so

var myName = "Ben";

Here you're trying to assign a value to console.log instead of calling it with myName

console.log(myName);

You don't need to console log anything here so just remove that. We want to update the value stored in myName like so. We already have your name stored in the myName variable so we use substring on it.

myName = myName.substring(0, 2);

console.log(myName);

#3

I now get an error saying that my code doesn't look right. I'm pretty sure I updated it according to your recommendations.

// On line 2, declare a variable myName and give it your name.
var myName = "Ben";
// 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);


#4

Still need to remove the '='

Also need to remove the space between substring and brackets


#5
Still need to remove the '='

and if you submitted this better refresh the page before you try again because if you've reassigned console.log it will tell you that it is not a function.


#6

Refreshing the page worked, thanks :smile:


#7

That worked, thanks :smile: Although I didn't have to remove the space in the substrings.