The Array Surgeon
Medium+30 XP
Mission Briefing
A toxic core has been detected right in the middle of a reactor chamber array! You must act as the array surgeon and violently remove it to save the system.
The Concept: Splicing Arrays
The .splice(start, count) method is the ultimate surgeon. It mutates the original array by removing or inserting elements anywhere you specify. It literally rips items right out of the middle!
Example: ["A", "B", "C"].splice(1, 1); // Rips out 1 item starting at index 1 ("B")
The Objective
Your function receives an array data.
- Use
.splice()to surgically remove the second element (which is located at index 1). - The function should return the mutated original array, NOT the removed item!
01EXAMPLE 1
Input
data = ["Keep", "Remove", "Stay"]Output
["Keep", "Stay"]Constraints
- Mutate the array and return it.
CoreArraysMethods
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
data["A","B","C"]
Expected Output
["A","C"]
Click RUN to test your solution