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

95
Views
Best shallow copy of array?

When I was reading the vue source code today, I encountered a writing method that I didn't understand.
view source

const deduped = [...new Set(pendingPostFlushCbs)]

In my opinion, it is a shallow copy of the array. But why should I convert to Set first,can I have better performance? How should I understand it?

almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

With Set you remove duplicates:

pendingPostFlushCbs = [1,2,5,5,6,8,8,]
const deduped = [...new Set(pendingPostFlushCbs)]
const deduped1 = [...pendingPostFlushCbs]
console.log(deduped)
console.log(deduped1)

almost 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!