6 pts
Create a function that takes an array (arr) of integers and returns an array that contains the same integers, in the same order. However, each value will be repeated twice(one after the other). You can assume the array (arr) will have at least one value in it. Example: repeatArray([1, 3, 5]) should return [1, 1, 3, 3, 5, 5]
function repeatArray(arr){
//Enter your code below
}
function repeatArray(arr){
//Enter your code below
}
Test Cases:
-
repeatArray([4,8,6,9]) to return [4,4,8,8,6,6,9,9]
-
repeatArray([1, 1]) to return [1,1,1,1]
-
repeatArray([0,-1, -2, 3]) to return [0,0,-1,-1,-2,-2,3,3]