25. There was a problem with your syntax?


Hi Leonhard,

1 var myCountry="Holland";
2 console.log(myCountry.length);
3 console.log(myCountry.substring(0:3));

Still got the message, There was a problem with your syntax?

What am I doing wrong?

Koos van Duijn

25/28 How to use variables

Via a google.search
javascript string.prototype.substring site:developer.mozilla.org
= https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring
you will find that the substring()-syntax uses the comma-, as parameter separator.

So if you provide an argument you have to use the comma-,-separator
and NOT as you do, using a colon-: as separator.

some quotes from the outer-world:

**argument is the value/variable/reference being passed in,
parameter is the receiving variable used within the function/block**


**"parameters" are called "formal parameters",
while "arguments" are called "actual parameters".**


You could try:

var myCountry = "Holland"


Did you check what output that produced? It helps give great answers if you test what you are suggesting that the new learners try.

We can see that Holland has 7 characters so we would know that the correct answer is 7.

console.log("myCountry".length) gives us 9, so we can see that isn't right.

If you do similar testing on console.log("myCountry".substring(0,3)); then you will find that it is also not correct.