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

110
Views
acces to previous element in element of arrays

i explain my question with an example :

    myArray=[10,15,42,74,65,2,7,9]

so, how can i acces to All elements for example before element '65' :

    newArray=[10,15,42,74]
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use Array.slice(start, length) to get just part of your original array, and Array.indexOf() to get index of the number 65.

let array = [10, 15, 42, 74, 65, 2, 7, 9]

// 0, because you want to start on the first index (10)
let newArray = array.slice(0, array.indexOf(65))
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!