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

150
Views
i need to break references in javascript

i have two arrays, at the begining one is empty and i assign what is in the other to this empty array. Something like this. $scope.module_Allquestions = $scope.module_questions.questions;

What i need to know is if there is some way to break references between two arrays, i'm working in some project in angular js. So i know that in es6 we can you spread operator. But i was told that in angular js that is behind es6 i can't use it. Do you know any way on how to make those arrays not referenced?

Thanks.

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

0

But i was told that in angular js that is behind es6 i can't use it

You were told wrong. Angular is just a JS library. You can use spread syntax if the JS engine you are running on supports it. (Which is basically "Anything except IE 11" and even then you can transpile it to ES5).

Other options include Array.from(scope.module_questions.questions) and scope.module_questions.questions.slice() for shallow copies and the Immer library for dealing with more complex data structures (such as when you have an array of objects).

about 4 years ago · Juan Pablo Isaza Report

0

Depending on your contents, you could go for a copy strategy such as $scope.module_Allquestions = JSON.parse(JSON.stringify($scope.module_questions.questions));

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!