Animate Your Name
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:

  • "Ryan"
  • "4"
  • "What is your name?"

In our code, we're using document.write() simply to display the string of your name in the preview window. The important stuff is inside the parentheses, so let's just focus on that.

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?

View Preview