10 XP challenge
Keep Alternating Positions
easy
Build it yourself · 6 min
1 Learn2 Predict3 Solve
TaskYour mission
Return the items at zero-based indices 0, 2, 4, and so on from numbers. numbers contains 0 to 30 integers from -100 to 100.
Examples
| Input | Return |
|---|---|
numbers = [1,2,3,4,5]answer: [] → [1] → [1,3] → [1,3,5]. The result is [1,3,5]. | [1,3,5] |
numbers = [7,8]answer: [] → [7]. The result is [7]. | [7] |
Your code
Write your answer inside Solution, then use return to send it back.
Ln 1, Col 1
JavaScript
Try examples runs the public examples. Check my code checks your full answer and saves your completion.