Javascript #25


#1

What did i do wrong?


#2

You need to place your string substring method inside the parenthesis of your console.log() method to display the data. kindly look on the syntax below for your reference.

console.log(string.substring(start,end));

Hope this helps


#3

@dantehero,
-1
if you use myCountry.length === 2
you are using the comparison operator ===
which will result into a Boolean value
in this case it will result in a Boolean false
a
console.log( myCountry.length === 2 );
will Display false

You were required to use
console.log( myCountry.length );

-2
You cannot take a substring() from a console.log() Method

With a console.log() Method you can Display a variable-value.

you can however
create a substring() from the associated-Value to the myCountry variable
like

myCountry.substring(0,2)

and then Display the result

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

Reference

google search
== the Book ==
javascript [your question] site:developer.mozilla.org

== discussions / opinions ==
javascript [your question] site:stackoverflow.com

== guidance ==
www.crockford.com
http://javascript.crockford.com/code.html <---JavaScript code-convention
http://javascript.crockford.com/survey.html
https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript
www.developer.mozilla.org/en-US/docs/Web/JavaScript/Guide