If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Teaching guide: Intro to JS - Text and strings

This is a teaching guide for the Intro to JS lesson on Text and strings.

What the student will learn

  • How to display text in their programs, with the text() command.
  • How to resize text using the textSize() command.
  • How to use variables to store strings of text.
  • How to concatenate multiple strings of text together with variables, using the + operator.

The student will be able to write code like:

Where students struggle

  • Students often forget to call fill() before displaying text. If they don’t call it, then their text will be transparent (invisible!).
  • Students may struggle with the syntax of strings - like using mismatched quotation marks (starting with a double quotation mark and ending with a single quotation mark) or often just leaving off quotation marks entirely (which confuses the program, as it will think it’s a variable).
  • When students try to concatenate multiple strings together, they often forget to put a + sign between each of the strings. Encourage them to scan their code carefully to look for that type of problem.

Additional materials: Trivia questions

These can be fun to do as a class after everyone’s gotten through the lesson. They can also lead to discussion about which questions are the hardest. Play them on Quizizz.

Want to join the conversation?