The following coding problem has me stumped. There are four tests, which begin with "// ex." They are followed by my code. My code is only passing the first test. I am unsure why it is failing the next 3. Thanks in advance for any insight.
// 1.4 repeat(n, array)
// Write a function that takes a non-negative integer n and an array and returns a new
// array that contains the contents of given array repeated n times.
// ex. repeat(0, [1]) -> []
// ex. repeat(10, []) -> []
// ex. repeat(1, [1, 2, 3]) -> [1, 2, 3]
// ex. repeat(3, [1, 2, 3]) -> [1, 2, 3, 1, 2, 3, 1, 2, 3]
toolbox.repeat = function(n, array) {
var arr = [];
for(var i = 0; i < n; i++){
arr.push(array);
}
return arr;
}