← Back to Artizan Software
A girl stands in a futuristic empty city, gazing at a glowing computer terminal

A Journey Through Time

Challenge 1

I'm standing in the middle of a city that's both familiar and strange. The buildings are taller, the streets are cleaner, and the sky is a shade of blue I've never seen before. But there's no one here. Not a single soul. Just me.

I've been stuck in this future for days now, and I'm desperate to get back to my time. Back to my friends, my family, my school. I miss the noise, the chaos, the life. Here, it's just silence.

I've found a computer in an abandoned library. It's sleek and shiny, unlike anything I've seen before. But it's my only hope. I need to send a message to the past, to someone who can help me.

I remember my computer science class from middle school. We were learning JavaScript, a programming language. I was never really good at it, but now, it's my only hope. I start typing, my fingers flying over the keyboard.

"Help. I'm stuck in the future. Please, I need to get back."

I hit enter and wait. The screen flickers, then goes blank. I feel a pang of disappointment. But then, words appear on the screen.

"Who is this? How can I help?"

I gasp. Someone's there. Someone's listening. I quickly type back.

"I'm a girl from the past. I don't know how I got here, but I need to get back. Can you help?"

There's a pause. Then, the words appear.

"I'll try. I know JavaScript. Maybe we can figure something out."

Days turn into weeks. We communicate through the computer, trying to figure out a way to bring me back. I describe the future to him, the strange buildings, the eerie silence, the loneliness. He tells me about the past, about school, about his friends. I miss it all so much.

One day, he sends me a message.

"I think I've figured it out. You need to type this code into the computer."

I follow his instructions, my heart pounding in my chest. I hit enter and close my eyes. When I open them, I'm back. Back in my time. I can hear the noise, the chaos, the life. I've never been so happy to see my school, my friends, my family.

I rush to the computer lab, to the boy who helped me. He's sitting there, typing away on his computer. He looks up as I approach, his eyes wide.

"You're the girl from the future,"

I nod, tears welling up in my eyes. "Thank you," I say. "You saved me."

He smiles, and I know we're going to be friends. Friends who share a secret no one else will ever understand.

· · ·

Can You Send a Message to the Screen?

In the story, she typed a message and it appeared on a screen in the past. In JavaScript, we can do the same thing. Let's learn how.

Sending a Message

console.log("Hello!") — This is how you send a message to the screen in JavaScript. It's the most basic and most important thing you can do.

Wrapping Code in a Function

function main() {} — A function is a block of code that does something. We wrap our code in a function to keep it organized.

Storing a Value

let message = "Hello" — A variable is like a labeled box. You put something in it, give it a name, and use it later.

Now it's your turn. Use the playground below to send your own message through time.