Complete the missing parts in the function createDuplicateArray that takes two parameters: an element and a number n.
The function should return an array of length n, where every element is the given element.
Complete the missing parts in the function createDuplicateArray that takes two parameters: an element and a number n.
The function should return an array of length n, where every element is the given element.
function createDuplicateArray(element, n) {
return Array().();
}
console.log(createDuplicateArray("x", 5)); // Output: ["x", "x", "x", "x", "x"]Create a free account to access the full topic