Stuck with 26. Changing variable values. What's wrong with my code?


#1

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


#2

@terasurfer39328

With the console.log() method
you are able to display any =value=
which you put into the so-called parameter holders ()

Thus
console.log(myName);

As you have re-assigned the console.log()-Method using
console.log = (myName)
your Browser-environment does not have a console.log()-Method anymore....

To get it back,you will have to do a refresh-Browser using the F5-keyboard-key.


#3

Put parentheses after console.log for line 4 and 9 as well.


#4

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