This forum is now read-only. Please use our new forums! Go to forums

0 points
Submitted by bhavanareddy somala
almost 10 years

change the variable value

in the below program am getting an error that Oops, try again. It looks like you didn’t log the first 2 letters of your name to the console! but am getting correct output please ccheckout and explain we in reply . // On line 2, declare a variable myName and give it your name. var myName=”bhavana”; // 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=”riavana”; // On line 9, use console.log to print out the myName variable. console.log(myName); thanks for your time

Answer 53586fe18c1ccc6b34000093

0 votes

Permalink

Line 7 needs to be using .substring to make the name the first two letters.

myName = myName.substring(0,2);

points
Submitted by Neil
almost 10 years

Answer 535cb61c548c3589040015af

0 votes

Permalink

var myCountry = “New York”;

console.log(myCountry.length );

console.log(myCountry.substring(0 , 3) );

points
Submitted by Arun Arun
almost 10 years

1 comments

Neil almost 10 years

This isn’t the exercise the OP is asking about.