All tutorials
JavaScript
beginner

Introduction to JavaScript

Learn variables, functions, arrays, and modern ES6+ syntax — the foundation of every web role in Africa.

1 min readMar 15, 2025by David Mwangi

Welcome to JavaScript

JavaScript powers browsers, servers (Node.js), and mobile apps (React Native). This tutorial covers essentials every African developer needs.

Variables and types

const country = "Kenya";
let developerCount = 12_000;
const skills = ["HTML", "CSS", "JavaScript"];
 
console.log(`${country} has ${developerCount}+ learners`);

const vs let

  • Use const by default
  • Use let when reassigning
  • Avoid var in modern code

Functions

function greet(name) {
  return `Karibu, ${name}!`;
}
 
const add = (a, b) => a + b;
 
console.log(greet("Amara"));
console.log(add(2, 3));

Working with arrays

const jobs = [
  { title: "Frontend Dev", remote: true },
  { title: "Backend Dev", remote: false },
];
 
const remoteJobs = jobs.filter((job) => job.remote);
console.log(remoteJobs);

DOM basics

const button = document.querySelector("#apply-btn");
 
button?.addEventListener("click", () => {
  alert("Application started!");
});

What to learn next

Explore async JavaScript (fetch, Promises) and then React for building UIs at scale.

Written by

DM

David Mwangi

Full Stack Developer, Nairobi

Published March 15, 2025

David mentors junior developers and contributes to open-source tools used across East Africa.