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

142
Views
Eliminar múltiples elementos de una matriz con splice()

Estoy tratando de eliminar varios elementos de una matriz con .splice() pero no obtengo el resultado deseado, ¿alguna sugerencia?

 const removeFromArray = function(arr, ...target) { //taking target as a rest parameter. for(let i = 0; i < arr.length; i++ ){ for(let j = 0; j < target.length; j++){ if(arr[i] == target[j] && typeof(arr[i]) == typeof(target[j])){ arr.splice(i , 1); //removing 1 element from i'th index. } } } return arr; }; console.log((removeFromArray([1, 2, 3, 4], 3, 2))) //[ 1, 3, 4 ] , should display [1,4]
about 4 years ago · Juan Pablo Isaza
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!