Data Types: Strings

Objective

Students must use string data types to store and manipulate text data in the game.

Evidence

String usage in game components:

  • GameLevelOutside.js - Character names, sprite paths
  • GameLevelMaze.js - Level identifiers and state strings
  • Multiple classes - NPC dialogue and game messages

Implementation Details

  • String literals with single and double quotes
  • Template literals for string interpolation
  • String methods for manipulation
  • String comparisons for game logic
  • Path construction and concatenation

Key Concepts

  • String primitives vs String objects
  • String methods (indexOf, substring, split, join, replace, etc.)
  • Template literals with ${} interpolation
  • String immutability in JavaScript
  • Regular expressions for pattern matching