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

144
Views
If i replace "arr[index]" with "arr[items]" i get an array with the values of [ 2, 0, 3, 4 ], can someone explain what is happening

const ary = [1, 5, 3]

ary.forEach(mult)

function mult(items, index, arr) {

  arr[items] = index * 2;
}

console.log(ary)

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

[1, 5, 3]

In the start items=1 index=0

arr[1]= 0*2 i,e 0

[1,0,3]

then items becomes 0 index=1
arr[0]= 1*2 i,e 2

[2,0,3]

then items becomes 3 index=2
arr[3]= 2*2 i,e 4

arr[2] remains same

items gets changed when arr[items] gets modified

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