0Pricing
Javascript for Kids · Lesson

Making Choices

Branch the story.

Choose Your Path! 🌿

The BEST part of an adventure game: choices! Go left or right? Open the door or run? Let us make the story branch! 🛤️

A Simple Choice 🤔

Store the player choice in a variable, then react to it with if.

let choice = "left"
if (choice === "left") {
  console.log("You go left into a sunny meadow! 🌼")
}

All lessons in this course

  1. Planning the Adventure
  2. Making Choices
  3. Winning
  4. Game Over
← Back to Javascript for Kids