26/28


#1

I don't know what have I done wrong in here.
// On line 2, declare a variable myName and give it your name.
var myName "Fjoni";
// 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 =("myName".substring(0; 2));
// On line 9, use console.log to print out the myName variable.
console.log = (myName);


#2

Hi there,

From what I can see there are a few different issues with your block of code.
I'll try to go through each of them.


// On line 2, declare a variable myName and give it your name.
var myName "Fjoni";

The variable myName should be assigned the value of "Fjoni", so you should have an = after var myName:
var myName = "Fjoni"


// On line 4, use console.log to print out the myName variable.
console.log = (myName);

When you write a console.log, you don't need to an = sign.
Instead of console.log = (myName); you want to write console.log(myName);

console.log() is already a function, and by using an equals sign you are overwriting the default behaviour of the console.log function.


// On line 7, change the value of myName to be just the first 2
// letters of your name.
myName =("myName".substring(0; 2));

Here you want to change the value of myName to the first two letters, but as myName is the name you've given a variable, you shouldn't be enclosing in in "" marks, what you're code is actually saying is to find the substring of the string "myName", rather than the substring of the variable myName which you've defined at the start of your code.

If you correct that, you should end up with:
myName = (myName.substring(0; 2));

The above is still wrong, as you shouldn't be using a semi-colon when trying to find the substring, instead you should be using a comma .substring(0,2)

Also, I don't actually think the opening and closing brackets at the start and end of (myName.substring(0; 2)); are actually necessary.

When you correct that, you should end up with a line of code that looks like:

myName = myName.substring(0, 2);


// On line 9, use console.log to print out the myName variable.
console.log = (myName);

Finally, as with my earlier comment about console.log, your last line should read:
console.log(myName);

Hope that helps.


#3

This is what I wrote
// On line 2, declare a variable myName and give it your name.
var myName = "Fjoni";
// 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);


#4

I'm going to copy and paste part of my previous reply with emphasis on the part you seem to have missed.

// On line 7, change the value of myName to be just the first 2
// letters of your name.
myName =("myName".substring(0; 2));

Here you want to change the value of myName to the first two letters, but as myName is the name you've given a variable, you shouldn't be enclosing in in "" marks, what you're code is actually saying is to find the substring of the string "myName", rather than the substring of the variable myName which you've defined at the start of your code.

If you correct that, you should end up with:
myName = (myName.substring(0; 2));

The above is still wrong, as you shouldn't be using a semi-colon when trying to find the substring, instead you should be using a comma .substring(0,2)

Also, I don't actually think the opening and closing brackets at the start and end of (myName.substring(0; 2)); are actually necessary.

When you correct that, you should end up with a line of code that looks like:

myName = myName.substring(0, 2);


#5

in my opinion
1) // On line 4, use console.log to print out the myName variable.
console.log = (myName);
you should input your variable value.like this : console.log=("Fjoni".length);

2)// On line 7, change the value of myName to be just the first 2
// letters of your name.
myName =("myName".substring(0; 2));
for this error i think you have to input you variable value. you can try like this: console.log=("Fjoni".substring(0,2));

3)and for number 2 and 9 i think you have true

hope my answer can help you