Why JavaScript First
Every web page you have ever used runs on three technologies: HTML for structure, CSS for style, and JavaScript for behavior. JavaScript is the only one of the three that is also a full programming language — and it is the language of React, Node.js, Express, and the entire modern web. Learn it once and it powers your whole career.
This guide assumes nothing. If you are brand new to code, start here and then follow the Kenya web developer roadmap to see how this fits the bigger picture.
Run JavaScript Without Installing Anything
The quickest way to start needs no setup at all. Open a modern browser, press F12 to open developer tools, and click the Console tab. Type this and press Enter:
console.log("Hello from the browser");You just ran JavaScript. For longer practice, create a file called app.js, link it from an HTML page with , and open the page in a browser. When you are ready for real projects, our Web Foundations course at Mwenaro wraps this learning in daily projects instead of lectures.
Variables: Boxes With Names
A variable is a named box for a value:
const name = "Amina"; let score = 0; score = score + 10;
Two keywords matter in modern JavaScript: const for values that never change, and let for values that do. Prefer const by default — it makes your code easier to reason about. (The old var keyword still exists but is rarely the right choice today.)
Data Types: The Building Blocks
JavaScript's basic building blocks are:
"hello"42, 3.14true / false[1, 2, 3]{ name: "Amina", age: 24 }These are the same shapes that appear in JSON, in APIs, and in databases. Get comfortable reading them before you worry about anything advanced.
Functions: Reusable Instructions
A function is a named block of instructions you can run any number of times:
function greet(name) {
return "Hello, " + name;
}
greet("Amina"); // "Hello, Amina"Functions are the single most important concept in programming. Everything you build — from a button click to an API route — is ultimately a function. When a program feels overwhelming, the fix is almost always to break it into smaller functions.
Control Flow: Making Decisions
Your code needs to branch and repeat:
if (score >= 100) {
console.log("Level up!");
} else {
console.log("Keep going.");
}
for (let i = 0; i < 5; i++) {
console.log(i);
}Start with if/else and for loops. They cover most logic you will write in your first months.
Arrays and Objects: Real Data
Real programs handle lists of things:
const tasks = ["learn JS", "build a site", "get hired"];
const user = {
name: "Amina",
skills: ["HTML", "JavaScript"],
};Learn the array methods that transform data — map, filter, find — early. They appear constantly in React code and in every technical interview.
The DOM: JavaScript Meets the Page
The Document Object Model is how JavaScript talks to HTML. Find an element, listen for a click, update the page:
const button = document.querySelector("#my-button");
button.addEventListener("click", () => {
document.querySelector("h1").textContent = "Clicked!";
});That () => {} is an arrow function — a shorter way to write functions, and the style you will see everywhere in modern code. Events are how all interactive websites work, so spend real time here.
Async: JavaScript's Big Idea
Some operations — fetching data from an API, reading a file — take time. JavaScript handles this with promises and async/await:
async function loadData() {
const response = await fetch("https://api.example.com/tasks");
const data = await response.json();
console.log(data);
}Do not rush this topic. It is the concept beginners struggle with most, and the one that unlocks everything from Node backends to real React apps.
Your First Four-Week Practice Plan
Passive watching does not build skill. Practice does — small, daily, measurable:
console.log. Write a program that stores your details and prints them.If you need a push, work through the beginner challenges on Mwenaro Arena — thirty minutes of solving small problems daily compounds faster than hours of tutorials.
What Comes Next
JavaScript unlocks the whole web: you are now ready for React, Node, and the full stack. The structured version of this exact path — where an instructor reviews your code and projects keep you accountable — is our coding bootcamp. Everything in this guide is where our Web Foundations track starts its students. Explore the Learn to Code cluster to keep going.