Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

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

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?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

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

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

over 4 years ago · Santiago Trujillo Report

0

Three dots in an object literal are a spread property, e.g.:

  const a = { b: 1, c: 1 };
  const d = { ...a, e: 1 }; // { b: 1, c: 1, e: 1 }

The last dot with a 0 is a number literal .0 is the same as 0.0. Therefore this:

 { ...(0.0) }

spreads all properties of the number object into the object, however as numbers don't have any (own) properties you get back an empty object.

over 4 years ago · Santiago Trujillo Report

0

In a simple terms {...} spread operator in javascript extends one object/array with another.

So, when babelifier tries extending one with another, it has to identify whether it is trying to extend an array or an object.

In the case of array, it iterates over elements.

In the case of object, it iterates over keys.

In this scenario, the babelyfier is trying to extract keys for number by checking the Object's own property call which is missing for number so it returns empty Object.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!