JavaScript Practice

The Big Idea

Reading about JavaScript is not the same as writing it. This session is pure practice — no new concepts, just building the muscle memory of actually typing and running code. You will use the browser console, a chatbot, and optionally FreeCodeCamp.


Your Roadmap

SectionTimeRequired?
Console challenges2 hours⚑ Required
Practice with a chatbot1 hour⚑ Required
Reflect15 min⚑ Required
FreeCodeCampOpen◎ Optional

Console challenges

Open your browser console (Right-click → Inspect → Console) and work through these. Type each one yourself — do not copy-paste.

Data types and variables

// 1. Declare a variable called myName and assign your name to it
// 2. Declare a variable called myAge and assign your age
// 3. Declare a variable called isLearning and set it to true
// 4. console.log all three variables

String joining

// 5. Create two variables: firstName and lastName
// 6. Join them together with a space between and log the result
// Hint: firstName + " " + lastName

Functions

// 7. Write a function called double that takes a number and returns it multiplied by 2
// 8. Call it with a few different numbers and log the results
// 9. Write a function called greet that takes a name and returns "Kia ora, [name]!"
// 10. Call it with your own name

Operators

// 11. Log whether 10 is greater than 5
// 12. Log whether "cat" === "dog"
// 13. Declare two variables: isAdult = true, hasTicket = false
// Log whether both are true (&&)
// Log whether at least one is true (||)

Stuck on any of these? Paste the challenge into your chatbot and ask: "I'm trying to solve this JavaScript challenge. Ask me questions to guide me — don't give me the answer yet."


Practice with a chatbot

Use your chatbot as a coding coach. Work through these prompts in order.

Round 1 — Generate challenges:

"I'm learning JavaScript for the first time. I know about data types, variables, functions, and operators. Give me 3 small coding challenges at beginner level — one at a time. Show me the first one and wait for my answer before showing the next."

Write your solution in the console. Paste it back and ask for feedback.

Round 2 — Explain your code:

Take one of the functions you wrote in the console challenges. Paste it and ask:

"Here is my code: [paste it]. Can you explain what each line does and tell me if there's a cleaner way to write it?"

Round 3 — Debug something:

Deliberately introduce a bug into one of your functions (misspell a variable name, remove a return, use == instead of ===). Paste it and ask:

"This code has a bug. Ask me questions to help me find it — don't tell me the answer directly."

Round 4 — Go further:

"What's the next JavaScript concept I should learn after variables and functions? Give me a one-paragraph explanation and one small code example."


How to know you've nailed it

LevelYou can...
🪨Intro ClimbComplete all the console challenges without looking up syntax⚑ Required
🧗Core AscentWrite and debug a function using the chatbot as a coach⚑ Required
🏔️SummitExplain what every line of your code does to the chatbot, and have it confirm you're correct◎ Optional

Reflect

Open sprint-2/my-reflections-sprint-2.md and add your answers under the JavaScript Practice heading.

Stage, commit, and push.


FreeCodeCamp

Optional — use this if you want more structured practice or if anything from the primer did not click.

Work through the Basic JavaScript section on FreeCodeCamp. Focus on the exercises covering variables, functions, and operators — skip ahead once you feel confident.