Js Destructuring — Free Javascript Tutorial
Learn Js Destructuring in Javascript with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.
TL;DR: Learn Js Destructuring in Javascript with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.
Written & reviewed by the Syllab.in Academic Team (CBSE/NCERT subject experts) · Updated
Js Destructuring in Javascript
Array destructuring: `const [a, b, c] = [1, 2, 3]`. Skip elements: `const [, second] = arr`. Default values: `const [a=0] = []`.
Object destructuring: `const { name, age } = user`. Rename: `const { name: fullName } = user`. Default: `const { score=0 } = user`.
Nested destructuring: `const { address: { city } } = user`.
Function parameter destructuring: `function greet({ name, age })` — pass an object, extract properties directly.
Swap variables: `[a, b] = [b, a]` — no temp variable needed!
Learn Js Destructuring step by step with Syllab's free interactive Javascript tutorial — runnable code examples, practice exercises and instant AI feedback, all free with no signup. Explore the full Javascript course →