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

96
Views
how to get an array out of a javascript proxy

Hi I was wondering if anyone knew how to get an array out of a proxy's target value in JavaScript. I have something like this :

Proxy :
  [[target]] : Array // the array I need to extract
  [[handler]] : Object 
  [[IsRevoked]] : false
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

If all you have is a reference to the proxy, there is no way (by default) for you to get the proxy's target. A specific proxy could provide a way (via one of its trap handlers, probably), but there is none by default.

about 4 years ago · Juan Pablo Isaza Report

0

As an addition, you may get a copy of the target by spreading if the handler maps everything accordingly. But you can not get the original [[target]] object.

const proxy = new Proxy([1, 2, 3], {
  get(target, prop, receiver) {
    return target[prop];
  }
});

console.log([...proxy]);

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!