Getting Started with Programming
Discover the length

Very good! You just wrote a string.
A string can contain letters, numbers, spaces, and symbols. Strings are surrounded with quotes.

These are all strings:

  • "Emily";
  • "4";
  • "What is your name?";

In JavaScript we add a semicolon at the end of each statement so the program knows where each statement ends.

To discover the length of a string, write the string within quotes. Then write a period (full stop) and the word length like this:



What's the length of your name?

After you click "Save & Submit Code" to run your code, the length of your name will show up in the console window at the top right of your screen. Make sure your window is maximized to see it!