26/28 error


#1

it keeps telling me I have not wrote my full name?
here is my code // On line 2, declare a variable myName and give it your name.
var myName = ("Brian Simmons") ;
// 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 = ("myName".substring (0,2));
// On line 9, use console.log to print out the myName variable.
console.log =("myName");

please help


#2

You're putting the variable myName as a string, or like this: "myName". This only prints out myName to the console, not printing your actual name.

Also on line 7, all you have to do is write myName, then the first 2 letters of your name.

Example:

myName = "Ry"

Hope it helped!:smiley:


#3

yeah this helped, thanks
i also needed to take the " " off of "myName" after console.log


#4

we just went over substrings so i thought it would want me to use them, ha just typing in your first two letters seemed too easy


#5

Using the substring method is fine, you just need to save the result back to myName or print it as otherwise the computed value is lost because it is not used. Also you don't need the () around every statement e.g. here:

var myName = ("Brian Simmons") ;

it is not necessary. And never do this:

console.log = ("myName");

console.log is a function (a fancy construct you'll get to know later that does really cool stuff like printing to the console) and the way you use it is by appending () and inserting a value between them. But what your code does is overwriting this functionality by "myName" and "myName" is not able to print anything to the console. So when you submit this you probably need to refresh the page afterwards to reset the functionality of console.log.