Help me here where do i mistake?


#1

// On line 2, declare a variable myName and give it your name.
var myName="otto";
// On line 4, use console.log to print out the myName variable.
console.log("myName".string);
// On line 7, change the value of myName to be just the first 2
// letters of your name.
console.log("otto".substring(0,2));
// On line 9, use console.log to print out the myName variable.
console.log("var myName".substring(4,10));
help me here where do i mistake?


What am i doing wrong here?
#2

By adding quotes to the myName variable, you have changed it to a string. Remove .string and the quotation marks.

When you first declare the myName variable, you assign it "otto". Now you are being asked to change the value of myName to the first 2 letters of your name, meaning "ot".

Console.log is a function that takes a parameter and logs it to the console. In this case, your parameter is myName and myName is what is passed into the parentheses after console.log.


#3

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