JavaScript runs the browser, the server (Node.js), and most of the modern web. It's quirky in places, but the modern parts are clean, expressive, and worth learning deeply.
1. Variables & Functions
Use const by default. Reach for let only when you must reassign. Avoid var.
const greeting = 'hello'
let count = 0
count += 1
const greet = (name) => `Hello, ${name}!`
greet('Koeuk')2. Async with Promises & await
Anything that takes time (network, files, timers) returns a Promise. await makes async code read like sync code.
async function loadUser(id) {
const response = await fetch(`/api/users/${id}`)
if (!response.ok) throw new Error('Failed to load')
return response.json()
}
const user = await loadUser(42)3. Modern Patterns
- Destructuring:
{ name, age } = user - Spread/rest:
[...arr, newItem] - Optional chaining:
user?.address?.city - Nullish coalescing:
value ?? 'default' - Modules:
import / exportinstead of CommonJS.
4. Array Methods Worth Memorizing
map, filter, reduce, find, some, every, flatMap. Most data work in JS is one of these.
Summary
Learn the modern subset well — const, arrow functions, destructuring, modules, async/await. The rest is mostly history you can read about later.