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

287
Views
How to remove/unset specific array in javascript?

How to remove/unset specific array in javascript? I tried to use splice but i get different result. I think I'm missing something here.

var arr = [12, 3, 150];
var min = 100;
var max = 200
for (var key2 in arr) {
    if (min > arr[key2] || arr[key2] >= max) {
        arr.splice(key2, 1);
    }
}
console.log(arr);

Current code output: [ 3, 150 ]

Expected output: [150]

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

0

Filter is way to solve your problem:

var arr = [12, 3, 150];
var min = 100;
var max = 200


console.log(arr.filter(e => e > min && e < max))

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!