CodeJavaScript + p5.js · ⌃ Space for hints
Draft saved locallyJavaScript · Spaces: 2
Live preview move your pointer inside
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 ispilotName, not a quoted name.
Mission complete Run sketch