ReadmeBuddy LogoReadmeBuddy
All Languages
JS

JavaScript

The language of the web

JavaScript is a high-level, interpreted programming language that powers the dynamic behavior of most websites. It runs in browsers and on servers via Node.js.

Web Development
Server-side (Node.js)
Mobile Apps
Desktop Apps
Game Development
Time to learn: 2-3 months
1Variables and Data Types
beginner
Use let and const to declare variables. JavaScript has primitive types like string, number, boolean, null, undefined, bigint and symbol.
const name = "ReadmeBuddy";
let count = 42;
const isActive = true;
const items = ["js", "ts", "py"];

console.log(typeof name);  // "string"
console.log(items.length); // 3
2Arrow Functions
beginner
Arrow functions provide a concise syntax and lexically bind 'this'.
const add = (a, b) => a + b;
const square = n => n * n;

const greet = name => {
  return `Hello, ${name}!`;
};

console.log(add(2, 3));   // 5
console.log(square(4));   // 16
3Array Methods
intermediate
map, filter, reduce and friends let you write expressive, functional code.
const nums = [1, 2, 3, 4, 5];

const doubled = nums.map(n => n * 2);
const evens   = nums.filter(n => n % 2 === 0);
const sum     = nums.reduce((acc, n) => acc + n, 0);

console.log(doubled); // [2, 4, 6, 8, 10]
console.log(evens);   // [2, 4]
console.log(sum);     // 15
4Async / Await
intermediate
async/await is syntactic sugar over Promises that makes asynchronous code read sequentially.
async function fetchUser(id) {
  try {
    const res  = await fetch(`/api/users/${id}`);
    const data = await res.json();
    return data;
  } catch (err) {
    console.error("Failed:", err);
  }
}

fetchUser(1).then(user => console.log(user));
5Destructuring & Spread
intermediate
Cleanly extract values from arrays and objects, or expand them in place.
const user = { name: "Ada", age: 30, city: "London" };
const { name, ...rest } = user;

const a = [1, 2];
const b = [3, 4];
const merged = [...a, ...b]; // [1, 2, 3, 4]
6Closures
advanced
A closure is a function that remembers its lexical scope even when invoked outside that scope.
function counter() {
  let count = 0;
  return () => ++count;
}

const next = counter();
next(); // 1
next(); // 2
next(); // 3

Built something with JavaScript?

Generate a professional README for your project in seconds.