0Pricing
Javascript for Kids · Lesson

Asking a Question

Get the players question.

Welcome to Magic 8-Ball! 🎱

Hi there, fortune teller! 👋 We are building a Magic 8-Ball! 🎱

You ask it a question, give it a shake, and it tells you the future! 🔮 First, we need to get the player's question. Let's go!

What is a Question? ❓

A question is just text, like 'Will I get pizza tonight?' 🍕

In code, text is a string. Let's store a question in a box! 📦

let question = 'Will it be sunny tomorrow?';
console.log(question);

All lessons in this course

  1. Asking a Question
  2. Random Answers
  3. Revealing the Fortune
  4. Add More Answers
← Back to Javascript for Kids