Skip to content

Latest commit

 

History

History
33 lines (18 loc) · 732 Bytes

string-length.md

File metadata and controls

33 lines (18 loc) · 732 Bytes

You will often need to know how many characters are in a string.

For this you will use the .length property. Here's an example:

var example = 'example string';
example.length

NOTE

Make sure there is a period between example and length.

The above code will return a number for the total number of characters in the string.

The challenge:

Create a file named string-length.js.

In that file, create a variable named example.

Assign the string 'example string' to the variable example.

Use console.log to print the length of the string to the terminal.

Check to see if your program is correct by running this command:

javascripting verify string-length.js


Index