10 XP challenge
Repeat Each Item Twice
easy
Build it yourself · 6 min
1 Learn2 Predict3 Solve
TaskYour mission
Return each item of numbers twice consecutively. For example, [2, 5] becomes [2, 2, 5, 5]. numbers contains 0 to 20 integers from -100 to 100.
Examples
| Input | Return |
|---|---|
numbers = [2,5]answer: [] → [2] → [2,2] → [2,2,5] → [2,2,5,5]. The result is [2,2,5,5]. | [2,2,5,5] |
numbers = [-1,0]answer: [] → [-1] → [-1,-1] → [-1,-1,0] → [-1,-1,0,0]. The result is [-1,-1,0,0]. | [-1,-1,0,0] |
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.