Why does {. . . .0} evaluate to {}?

  • A+

I just found {....0} in friend's code. Evaluating it in console returns {} (empty object).

Why is that? What is the meaning of 4 dots in JavaScript?

Edit: IDK why, but the title of my question is edited, instead of 4dots it shows just 3, Edit2: got it working by adding space in between the dots


Four dots actually have no meaning. ... is the spread operator, and .0 is short for 0.0.

Spreading 0 (or any number) yields an empty object, therefore {}.


:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: