🖨 Print / Save PDF
← Lesson
BitWith
Bite
Full-Stack · Quick Reference
Lesson 15 — Functions
Cheat Sheet
Full-Stack
In one line:
Declarations are hoisted, expressions aren't, and arrow functions have no own "this" — which is exactly why React uses them for handlers.
Key Ideas
1
Declaration.
function name(){} — hoisted.
2
Expression.
const name = function(){} — not hoisted.
3
Arrow.
const name = () => {} — no own this.
4
Default params.
function f(x = 10) {}.
5
Destructuring.
Pull values from objects/arrays directly.
Examples
const greet = name => `Hello, ${name}!`; const power = (base, exp = 2) => base ** exp; power(3); // 9 const { name, age } = user; const [first, ...rest] = [1,2,3,4];