Read code like a builder (with AI as your tutor)
Variables, functions, if/else, loops, objects and components: just enough JavaScript to read what AI writes and ask better questions.
You don't need to write it all. You do need to read it.
Vibe coding lets AI type the code, but you're still responsible for what it does. Being able to read a little code helps you spot when the AI did something odd, explain bugs precisely, and learn faster every time you build.
The examples here are JavaScript, the language of the web. Most languages use the same ideas with different spelling.
Variables: named boxes
A variable stores a value under a name. const price = 20 creates a box called price holding 20 that won't change. let count = 0 creates one that can change later (count = count + 1).
Values have types: numbers (20), strings of text ("hello"), booleans (true or false), lists called arrays (["red", "blue"]) and objects that group named values ({ name: "Ada", age: 36 }).
Functions: reusable recipes
A function is a named recipe that takes inputs (parameters) and returns an output. function total(price, tip) { return price + price * tip } takes a price and a tip rate and returns the total. You call it with total(20, 0.15).
You'll also see arrow functions, a shorter way to write the same thing: const total = (price, tip) => price + price * tip.
Decisions and repetition
- if / else: if (age >= 18) { showSignup() } else { showParentNote() }. Only one branch runs.
- Comparisons: === means 'is exactly equal', !== 'is not equal', and && means AND, || means OR.
- Loops repeat work: for (const item of cart) { sum = sum + item.price } adds up every item.
- Array helpers do common loops for you: items.map(...) transforms each item, items.filter(...) keeps some, items.find(...) gets one.
Components, imports and async
In React, a component is a function that returns what the screen should show, written in JSX (HTML-like tags inside JavaScript): function Greeting({ name }) { return <h1>Hi, {name}</h1> }. Props are the inputs to a component; state is data the component remembers and updates.
import pulls code from another file or package; export shares it. async and await handle things that take time, like loading data from a database: const notes = await getNotes() waits for the answer before continuing.
Use AI as a tutor, not just a typist
- 'Explain this file line by line for a beginner. Don't change anything.'
- 'What would happen if this value were empty?'
- 'Rewrite this function more simply and explain the difference.'
- 'Quiz me with three questions about this code.'
- Change one small thing yourself (a label, a number) and predict what will happen before you run it.
Key terms
- Variable
- A named value in code, like const price = 20.
- Function
- A named, reusable recipe in code that takes inputs and can return an output.
- Array
- A list of values in code, like ["red", "blue"].
- Object (in code)
- A group of named values, like { name: "Ada", age: 36 }.
- Conditional (if/else)
- Code that runs only when something is true, otherwise something else.
- Loop
- Code that repeats for each item in a list or until something changes.
- Component
- A reusable piece of interface, in React a function that returns what to show.
- Props
- The inputs passed into a React component.
- State
- Data a component or app remembers and updates, like what's in a cart.
- Async / await
- Code for slow tasks like loading data: await waits for the answer.
- JavaScript
- The programming language that makes web pages interactive.
Try it
Predict, then run
- Ask an AI for a 20-line JavaScript tip calculator with a function, an if/else and a loop.
- Before running it, write down what you think it prints.
- Run it (an online playground or your browser's console works) and compare.
- Ask the AI to quiz you on it, and change one line yourself to see what breaks.
Ask an AI tutor about this guide
Copy a prompt into ChatGPT, Claude or Gemini to go deeper. Check what it tells you against the guide.
- Explain it like I'm 12
- Quiz me (5 questions, one at a time)
- Show me a real example for my situation
- What do beginners get wrong?
Knowledge check
Five questions. Get 4 right to earn the Code Reader badge. You can retake it as often as you like.
Question 1 of 5
Finished the How software works guides? Take the How software works track test for ten mixed questions.
My notes
Write what clicked, what confused you, and what you want to try. Saved in this browser only.
Learn it live
Digital Builders University runs small live workshops where you build something real with an instructor beside you, starting with Vibe Coding 101.
See workshopsPractise it
- Build Challenge: Habit tracker with streaks (Builder, 3 hours)
- Code playground: Loop through a list (edit and run it in your browser)
- Code playground: Write a function (edit and run it in your browser)
- Code playground: Transform lists with map and filter (edit and run it in your browser)
- Code playground: Wait with async and await (edit and run it in your browser)
- Game: Code Scramble (put the lines of a working program back in order)
- Game: Bug Hunt (read short code snippets and find the bug)
- Game: Predict the Output (run tiny snippets in your head)
- Game: Prompt Fixer (pick the prompt that gets the best result)
Official sites
Last reviewed November 25, 2026. AI tools change fast; check each tool’s own site for current features, plans and prices.
