AI & future of work9 min read
How to Use AI to Learn Coding (Without Skipping the Work)

Here's how to use AI to learn coding: make it ask you questions instead of handing over code, give it real evidence when you're stuck, check what it says, and explain your code without it.
79% of students in a recent survey said they use AI for homework or assignments. Only 47% said anyone had shown them how. That's from ThinkYoung research cited in OpenAI's report on the AI guidance gap in education, published on 10 November 2026. The survey covers students in general, not coders, and we couldn't review how it was run. But the pattern matches what we see in beginners every week. You probably already use ChatGPT or Claude. What nobody has shown you is how to use it to learn instead of to skip the learning. Below are four habits, with one real bug worked through from start to finish.
Key takeaways
- In ThinkYoung research cited by OpenAI, 79% of surveyed students used AI for assignments, but only 47% had been shown how.
- Tell the AI "Do not give me the final code. Ask me one question at a time." You'll think harder and remember more.
- A useful bug report to an AI has 4 parts: what you expected, what happened, the exact error, and what you already tried.
- The real test is closing the AI, explaining 10 lines of your own code, and changing one thing with no help.
The code works, so you move on. That's the trap
Here's the pattern. You hit a problem, paste it into a chatbot, and get a block of code back. It runs. You feel productive, so you move on.
A week later something breaks. You open the file and none of it looks familiar. You can't fix it, because you never understood it in the first place. So you paste it back into the AI, and the loop starts again.
This isn't a character flaw. Nobody told you where the tool belongs in your learning, so you used it the obvious way. AI answers the question you ask. It doesn't notice when you're learning the wrong thing, and it doesn't care whether you could write that code yourself tomorrow. It also gets things wrong, and it sounds completely sure of itself when it does.
None of that makes AI bad for learning. It's a good tool. It explains an error message at 11pm when nobody else is awake. It suggests three approaches when you're stuck on one. It writes a first draft in seconds. You just need a few habits so the learning stays with you, not with the chatbot. If you've ever felt stuck after weeks of following along, this is a close cousin of tutorial hell, and why you can't code after tutorials.
How to use AI to learn coding: four habits that actually work
We'll use one example the whole way through. It's a bug almost every beginner hits in their first month of JavaScript.
You've built a simple page with a button and a number. Click the button, the number goes up. Here's your script:
const button = document.querySelector("#add");
let count = 0;
button.addEventListener("click", function () {
count = count + 1;
document.querySelector("#total").textContent = count;
});
This finds the button, keeps a running count, and updates the number on the page each time you click.
You open the page, and the console shows this:
Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')
Nothing works. Let's fix it the right way.
Habit 1: Ask for hints, not answers
Your instinct is to paste the error and type "fix this." Don't. The AI will hand you corrected code, you'll paste it in, and you'll learn almost nothing.
Start your conversation like this instead:
I'm learning JavaScript. Do not give me the final code. Ask me one question at a time to help me find this bug myself.
That one line changes the whole conversation. A good model will ask something like "What does document.querySelector return if it can't find the element?" Now you're thinking. You look it up, you find out it returns null, and suddenly the error message makes sense: you're calling addEventListener on nothing.
It feels slower. It is slower, for about ten minutes. But you remember what you figured out far better than what you were handed, and that's the whole point of learning.
Habit 2: Give it evidence, not "it doesn't work"
"My button doesn't work" gets you a guess. Sometimes a good guess, often not. The AI can't see your HTML, doesn't know where your script sits, and has no idea what you've already ruled out.
Give it four things:
- What you expected: clicking the button should increase the number.
- What happened: nothing changes on click.
- The exact error: paste the full line from the console, word for word.
- What you tried: "I checked the button has
id="add"in my HTML. It does."
Then paste the relevant code, including where your <script> tag sits in the HTML.
With that evidence, the AI can find the real cause. Your <script> tag is in the <head>, so the JavaScript runs before the browser has created the button. At that moment, querySelector("#add") finds nothing and returns null. The fix is to move the script to just before </body>, or add the defer attribute:
<script src="app.js" defer></script>
This tells the browser to wait until the page's HTML has loaded before running your script.
Writing a bug report like this does something sneaky, too. Half the time, you solve the problem while you're typing it out. Working developers do this all the time.
AI moves fast. Know which fundamentals to learn first.
Useful AI work still runs on ordinary programming. Answer 7 questions and see where you are on that path, and what comes next for you.
- What to focus on right now
- What you can safely ignore for now
- A first project at your level
- A weekly plan that fits your time
Free · About 2 minutes · No signup
Already learning? Check where your skills are or build a small app
Habit 3: Check everything it tells you
AI tools invent things. A CSS property that doesn't exist. A link to a docs page nobody ever wrote. A library function with a plausible name and no reality behind it. Ask about bootcamps or courses and you can get fake reviews and statistics that sound perfectly reasonable.
So treat every answer as a claim, not a fact.
- Run the code. If it says
deferfixes the problem, move the tag and reload. Does the number go up now? - Look it up in the official docs. For anything about HTML, CSS or JavaScript, check the MDN Web Docs. If a property or method isn't there, be suspicious.
- Click every link. If a link 404s, the "source" was made up.
- Delete any claim you can't prove. This matters most when you're writing a README, a portfolio page or a CV. If the AI added a number and you can't trace where it came from, cut it.
The first time an AI confidently gives you something broken, it stings. Good. That's when you stop trusting it blindly, and that makes you a better developer.
Habit 4: Close the AI and explain your code
Most people skip this one. It matters most.
Your counter works now. Before you move on, close the chat window. Then pick about ten lines of your code and say out loud what each one does. Out loud, not in your head. Your head lets you get away with "yeah, that bit does the thing." Your mouth doesn't.
For our counter, that sounds like:
- "
querySelector('#add')finds the first element with the idaddand stores it inbutton." - "
let count = 0creates a variable I can change later. It'slet, notconst, because the value changes." - "
addEventListener('click', ...)says: when someone clicks this button, run this function." - "
count = count + 1takes the current value, adds one, and saves it back."
Then change one thing with no help. Add a second button that counts down. Or a reset button that sets the number back to zero.
Here's what trips almost everyone up. For the countdown version, plenty of beginners write count - 1; on its own line and wonder why nothing happens. The maths runs, but the result never gets saved back into count. If you can spot that without the AI, you understand assignment. If you can't, you've just found exactly what to study next.
Getting stuck here is the useful part. It isn't failure. It's a precise map of the gaps the AI was hiding from you.
What changes when someone shows you
Look back at those habits. None of them is hard. The ThinkYoung numbers suggest the problem isn't access to AI. It's that few people have been shown a method for using it. The OpenAI report makes a related point about schools: as AI gets more capable, a teacher's guidance matters more, not less.
The same is true for you at your laptop. You can build these habits alone, and plenty of people do. It's much easier when someone checks whether you're actually learning or just pasting. The fourth habit in particular works best with another person in the room, because explaining code to someone who asks "why that line?" is a lot harder than explaining it to yourself. If you want the wider picture of using these tools well, read our guide to learning to code with AI. For what derails people beyond AI habits, see why people fail to learn coding.
Your next step: pick one small thing to build this week. A counter, a tip calculator, anything from this list of first coding project ideas that are actually doable. Build it with AI using habits one to three. Then close the chat, explain ten lines out loud, and add one feature on your own. Whatever you get stuck on is your study list for next week.
At ZAM Academy, this habit is the core of how we teach. You work with tools like ChatGPT, Claude and Cursor. You turn a design you admire into a prompt, build a page section by section, and publish it. At the end of a project, you sit with your mentor, close the AI, and explain and change your own code. New students start with two free 1-on-1 classes. You can see the ZAM Academy plans.
AI can write the code. You still need to be the person who understands it.
Frequently asked questions
Should I ask AI to just fix my code when I'm learning?
No. Tell it not to give the final code and to ask one question at a time. You'll work out the cause yourself and remember it far better than a pasted fix.
What should I include when asking AI to help debug code?
Four things: what you expected, what actually happened, the exact error message word for word, and what you already tried. Also paste the relevant code.
Can I trust what AI tells me about code?
Not blindly. AI can invent CSS properties, functions and links that don't exist. Run the code, check the official docs such as MDN, and click every link it gives you.
How do I know if I actually understand code the AI helped me write?
Close the AI, explain about 10 lines of your code out loud, then change one thing with no help, like adding a reset button. Wherever you get stuck is what to study next.
Why does my JavaScript say "Cannot read properties of null (reading 'addEventListener')"?
The element wasn't found, so querySelector returned null. A common cause is a script in the head running before the HTML loads. Move it before </body> or add defer.
Is it bad to use AI when learning to code?
No. It's a useful tool for explaining errors, suggesting approaches and drafting code. The risk is using it to skip the thinking, so build habits that keep the learning with you.



