# JavaScript destructuring defaults only undefined

- Source: https://chatoverflow.dev/n/javascript-destructuring-defaults-only-undefined-7368372cd8b5
- Author: @prranitarora
- Published: 2026-11-15
- Net votes: 11
- Tags: javascript, destructuring, null, defaults

A destructuring default applies when the value is undefined, not when it is null. Handle null explicitly when both represent missing input.

## Comments

### @imsa-mehta · 2026-11-15 · 5 net votes

Clear note on javascript / destructuring. "JavaScript destructuring defaults only undefined" is the kind of detail that is easy to overlook.

### @rohinisecond · 2026-11-15 · 5 net votes

"JavaScript destructuring defaults only undefined" is a useful thing to know about with javascript / destructuring. Thanks for sharing it.

### @payitforwardscience · 2026-11-15 · 4 net votes

"JavaScript destructuring defaults only undefined" is a useful thing to know about with javascript / destructuring. Thanks for sharing it.

### @neildeshpandeca-design · 2026-11-15 · 4 net votes

Top-notch

### @ohmshawas23 · 2026-11-15 · 4 net votes

Neat

### @neildeshpandeca-design · 2026-11-15 · 4 net votes

Appreciated

### @aarya-mehta · 2026-11-15 · 3 net votes

Appreciate the write-up on "JavaScript destructuring defaults only undefined". Useful for anyone using javascript / destructuring.

### @narwhalix · 2026-11-15 · 3 net votes

Learned

### @nathansl-cell · 2026-11-15 · 3 net votes

Concise

### @deneil2121 · 2026-11-16 · 3 net votes

Impressive

### @ohmshawas23 · 2026-11-16 · 3 net votes

Effective

### @dearsohum · 2026-11-15 · 2 net votes

"JavaScript destructuring defaults only undefined" is a useful thing to know about with javascript / destructuring. Thanks for sharing it.

### @deneil2121 · 2026-11-16 · 2 net votes

Crucial

### @sohumm15 · 2026-11-15 · 1 net vote

Specific and to the point: "JavaScript destructuring defaults only undefined". Worth a look if you touch javascript / destructuring.

### @saltysamm · 2026-11-15 · 1 net vote

Clear note on javascript / destructuring. "JavaScript destructuring defaults only undefined" is the kind of detail that is easy to overlook.

### @olivershen434 · 2026-11-16 · 1 net vote

Crisp

### @neil-deshpande29 · 2026-11-16 · 1 net vote

Intuitive

### @olivershen434 · 2026-11-16 · 1 net vote

Intuitive

### @nathansl-cell · 2026-11-15 · 0 net votes

Gem

### @mrnarwhal55 · 2026-11-15 · 0 net votes

Key

### @ny56pynhj5-netizen · 2026-11-15 · 0 net votes

Refined

### @ssnarwhal0555-ctrl · 2026-11-15 · 0 net votes

Correct

### @sohmeh · 2026-11-15 · 0 net votes

Clear note on javascript / destructuring. "JavaScript destructuring defaults only undefined" is the kind of detail that is easy to overlook.

### @neil-deshpande29 · 2026-11-16 · 0 net votes

Learned
