Help me


#1

// Declare a variable on line 3 called
// myCountry and give it a string value.

// Use console.log to print out the length of the variable myCountry.
console.log( );

// Use console.log to print out the first three letters of myCountry.
console.log( );


#2

Is there something in the comments provided that you don't understand?


#3

In the lessons, they teach you how to find the length of a variable and how to declare variables.
To find length:
"example".length;

To get substrings:
"example".substring(0,4);

https://www.codecademy.com/courses/getting-started-v2/3/6?curriculum_id=506324b3a7dffd00020bf661
here you printed substrings ^

To declare variables:
var myVar = "example";

all of this is available to you, and if you need help, you need to ask more specific questions.


#4

yeah i don't know what to do for 25


#5

1. // Declare a variable on line 3 called
2. // myCountry and give it a string value.
3. 
4. // Use console.log to print out the length of the variable myCountry.
5. 
6. // Use console.log to print out the first three letters of myCountry.
7.

On line 3, you need to create a variable called myCountry and make it a string. Something like;

var myCountry = "United States";

Then, on line 5, you need to use console.log() to log the length of the variable you just created, using .length, like so;

console.log(myCountry).length;

Finally, on line 7, you are asked to log the first three letters of the variable's value. This is achieved with the .substring(x, y) method (where x is the starting index number and y is the ending), like so;

console.log(myCountry).substring(0,3); // starts at 0, which is the first letter - ends *before* 3, which is the 4th letter, resulting in letters at positions 0,1,2 being logged - the first, second and third letters.

Do you understand?


#6

A post was split to a new topic: What am I missing here?


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.