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

banner
Close banner
0 points
Submitted by Nir Zavaro
about 10 years

what am i doing wrong? lesson 26 in javascript

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

Answer 535123cd52f8635239001959

0 votes

Permalink

Try this one bellow and compare it with yours :).

var myName = (“Nir”);

console.log(myName);

var myName = (“Nir”.substring(0,2));

console.log(myName);

points
Submitted by panzerdeni
about 10 years

3 comments

Nir Zavaro almost 10 years

it keeps saying i did not declare a variable…odd

Nir Zavaro almost 10 years

only when i actually copied it worked!!!! many tnx

panzerdeni almost 10 years

ok. Those are your errors that you made Line 2 : “nir”… it needs to be in ( ) and on the end ; semicolon and you can use /// var myName just for looks i think with N.