CodeJavaScript + p5.js · ⌃ Space for hints
Draft saved locallyJavaScript · Spaces: 2
Live preview move your pointer inside
Mission 01 8 min
Reward+100 XP

Create a String Variable

A string is text inside quotes, such as "Comet". Store text in a variable the same way you stored numbers: let pilotName = "Comet";. After giving the text a name, use pilotName wherever the program needs that value instead of repeating the word itself.

Learn more

01
Your mission

Create a pilotName string containing "Comet", then make the sketch display the variable instead of the hard-coded name "Nova".

  • Create let pilotName = "Comet";.
  • Change text(...) so its first argument is pilotName, not a quoted name.
Mission complete Run sketch
Mission demoCreate a String Variable

Finished result only — the answer code stays hidden.