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

264
Views
Is it possible to "reverse spread" with Object.assign()?

I know "reverse spread" might not be the proper description for it but I couldn't think of anything else.

I'm trying to remove a set of keys like a and b, from an object and store the rest in rest.

const { a, b, ...rest } = bunchOfKeysAndValues;

But I can't use spread operator.

Is it possible to achieve this with Object.assign() or in some other way?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use Object.assign() to make a copy of the object, extract a and b from it, then remove them.

const rest = Object.assign({}, bunchOfKeysAndValues);
const {a, b} = rest;
delete rest.a;
delete rest.b;
about 4 years ago · Juan Pablo Isaza 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!