0Pricing
Javascript for Kids · Lesson

Revealing the Fortune

Reveal the fortune.

Revealing the Fortune is a free Javascript for Kids lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Javascript for Kids learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Reveal the Fortune! ✨

Welcome back, fortune teller! 🌟 Last time we picked a random answer. 🎲

Now let's reveal the fortune in a magical, fun way! ✨🎱

Show the Chosen Answer 🎯

First, pick an answer and show it! 🎯

We print it with console.log so everyone can see. 🖨️

let answers = ['Yes!', 'No', 'Maybe'];
let pick = Math.floor(Math.random() * answers.length);
console.log('The 8-Ball says: ' + answers[pick]);

Add a Magic Intro 🔮

Build suspense with a magic intro! 🔮

It feels more like a real fortune teller! 😲

console.log('🔮 Shaking the magic 8-ball... 🎱');
console.log('🔮 The answer is...');

Intro Plus Answer ✨

Now put the intro and the answer together! ✨

Shake, then reveal! 🎉

let answers = ['Yes!', 'No', 'Maybe'];
let pick = Math.floor(Math.random() * answers.length);
console.log('🔮 Shaking... 🎱');
console.log('✨ ' + answers[pick] + ' ✨');

Show the Question Too 💬

Let's show the question that was asked! 💬

It makes the fortune feel personal. 😊

let question = 'Will it be sunny?';
let answers = ['Yes!', 'No', 'Maybe'];
let pick = Math.floor(Math.random() * answers.length);
console.log('❓ You asked: ' + question);
console.log('🎱 8-Ball: ' + answers[pick]);

A Fancy Reveal Box 🖼️

Frame the fortune with stars for a fancy reveal! 🖼️

So magical! ✨

let answers = ['Yes!', 'No', 'Maybe'];
let pick = Math.floor(Math.random() * answers.length);
console.log('⭐⭐⭐⭐⭐');
console.log('  ' + answers[pick]);
console.log('⭐⭐⭐⭐⭐');

A Reveal Function 🤖

Let's make a function that reveals the fortune! 🤖

Call it anytime to ask the 8-ball! 🎱

let answers = ['Yes!', 'No', 'Maybe', 'For sure!'];
function reveal() {
  let pick = Math.floor(Math.random() * answers.length);
  console.log('🔮 The 8-Ball says: ' + answers[pick]);
}
reveal();

Ask Three Times 🔁

Let's ask the 8-ball three times! 🔁

Each reveal can be different! 😲

let answers = ['Yes!', 'No', 'Maybe', 'Try again'];
function reveal() {
  let pick = Math.floor(Math.random() * answers.length);
  console.log('🎱 ' + answers[pick]);
}
reveal();
reveal();
reveal();

Reveal With a Question 💫

Let's combine the question and a fancy reveal! 💫

This is a complete fortune! 🌟

let answers = ['Yes!', 'No', 'Maybe'];
function ask(question) {
  let pick = Math.floor(Math.random() * answers.length);
  console.log('❓ ' + question);
  console.log('🔮 ' + answers[pick]);
}
ask('Will I get ice cream?');

The Full Magic 8-Ball 🎱

Here is the complete reveal experience! 🎱

Shake, ask, and reveal the magic! ✨

let answers = ['Yes!', 'No', 'Maybe', 'Ask later'];
function ask(question) {
  let pick = Math.floor(Math.random() * answers.length);
  console.log('🎱 Shaking...');
  console.log('❓ ' + question);
  console.log('✨ ' + answers[pick] + ' ✨');
}
ask('Will today be awesome?');

You Revealed the Fortune! 🏆

Magical work! 🏆 You learned to:

  • 🎯 Show the chosen answer
  • 🔮 Add a fun intro and 🖼️ a fancy frame
  • 🤖 Use a function to reveal fortunes

Next lesson: add your OWN answers! ✏️

Quick Check ✅

Brain time! 🧠 How do we show the 8-ball's answer to everyone?

Lesson Recap 🎀

Super job, fortune teller! 🎀 Today you learned:

  • 🎯 Show the picked answer
  • 🔮 Add a fun intro and frame
  • 🤖 A function reveals the fortune

Next: add more answers! ✏️

Frequently asked questions

Is the “Revealing the Fortune” lesson free?

Yes — the full text of “Revealing the Fortune” is free to read here on the web, and the Javascript for Kids course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Javascript for Kids course, upgrade to CoddyKit PRO.

What will I learn in “Revealing the Fortune”?

Reveal the fortune. You practise Javascript for Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Javascript for Kids?

No prior experience is required. Javascript for Kids on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Revealing the Fortune” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Javascript for Kids lesson?

Yes. Every Javascript for Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

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