Hi everyone,
I was wondering if it was possible to make a function which receive an array as a parameter, and apply some splice () to it
Alright i am stupid to want to force a defined array, i shall just write something to splice what was inputed, sorry for the bothering
Solution was :
function displayNumbers(arr) {
arr.splice(4,2);
return arr;
}
console.log(displayNumbers([1,2,3,4,5,6,7,8,9,10]));
god i’m stupid
Your code so far
const arr = [2, 4, 5, 1, 7, 5, 2, 1];
arr.splice(1,4);
console.log(arr);
I did this so far but i am struggling to find the problem related to it …
function displayNumbers(arr) {
let arro = [];
let prout = arr.splice(4,2);
return
}
displayNumbers()
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36
Challenge: Basic Data Structures - Remove Items Using splice()
Link to the challenge: