How to start programming with one small working project
- Cost to start
- ~$0
- Difficulty
- Beginner
- First result
- 1-2 hours
Computer, browser, free editor
Keep the first project tiny
A button that updates a page
Build a tiny interactive web page, learn a calm debugging routine, and turn beginner lessons into your own projects without chasing every language.
What you need to know
-
Choose an outcome before a language
A tiny page, game or automation gives each new concept a job. The universally perfect first programming language does not exist.
-
Use two small text files
HTML supplies the button and result area. JavaScript changes the text when you click. Save both files together in a plain-text editor.
-
Type, predict and change every example
Before running a line, say what you expect. Then alter one value or condition and explain why the result changed.
-
Treat errors as evidence
Read the first console error, note its file and line, inspect the nearby code and test one hypothesis instead of rewriting everything.
-
Keep private information out of code
Never paste passwords, access tokens or personal data into a project, public repository, coding assistant or unfamiliar command.
Put a button on the page
Make a folder called first-page. In a plain-text editor, save the following as index.html inside it. Open the file in a browser. You should see a button and a short instruction.
<!doctype html>
<html lang="en">
<meta charset="utf-8" />
<title>What shall I draw?</title>
<button id="choose">Pick a subject</button>
<p id="result" aria-live="polite">Press the button for an idea.</p>
<script src="script.js"></script>
</html>
Make the page respond
Save this second file as script.js in the same folder. The names after the hash signs match the two IDs in your HTML. Each click shows one subject and advances the index. The remainder operator (%) takes it back to zero after the last subject.
const subjects = ['a mug', 'a leaf', 'a shoe'];
const button = document.querySelector('#choose');
const result = document.querySelector('#result');
let index = 0;
button.addEventListener('click', () => {
result.textContent = subjects[index];
index = (index + 1) % subjects.length;
});
Refresh the page and click four times. The fourth click should show the mug again. Add one subject to the list, save and refresh. Predict which click will bring the mug back.
Build a calm debugging loop
When nothing happens, open the browser developer tools and select the Console. Read the first error before the cascade beneath it. The message usually names a file, line and error type. Check spelling, capitalization, quotes and brackets around that line.
Save your work and choose a direction
Make a copy of the folder after the first working version, or learn basic Git once you want a durable history. A version-control commit is a named checkpoint, not a cloud backup by magic.
Learn, debug and share
- MDN Learn web developmentA structured path from environment setup through HTML, CSS and JavaScript, written for complete beginners.
- Troubleshooting JavaScriptA practical MDN lesson on syntax, runtime and logic errors using the browser console.
- WAI accessibility tutorialsW3C guidance for building common web content so that people with disabilities can use it.
- Introduction to GitHubA hands-on, under-one-hour exercise covering repositories, branches, commits and pull requests.
YouTube channels
Subreddits
Podcasts
Read and try the code
Apps for your phone
-
Mimo
Short JavaScript, HTML and CSS exercises can reinforce syntax away from your desk; use them to supplement, not replace, your own project.
Turn this into income
Make a tiny indie game before pricing a release
Build a five-passage Twine puzzle, test every choice and replay, then price a larger original downloadable game with storefront fees.
Prototype a small mobile app before selling it
Build a saved knitting row counter, test its controls, and compare a one-time price with store fees and maintenance before publishing.