I'm trying to push values into array by recursive function, but I get the error message "Uncaught TypeError: Array.push() is not a function", although the push() method is a regular array method. Where the problem could be?
let someArr = ['a', 'b', 'c'];
let someNum = 3;
let fillArr = (arr, num) => x = (num != 0) ? fillArr(arr.push(num), num -1) : arr;
console.log(fillArr(someArr, someNum))
// expected output: ['a', 'b', 'c', 3, 2, 1];
// actual output: Uncaught TypeError: arr.push is not a function
concatinstead ofpushArray.pushreturns an int, and you're passing that int as argument forarrin your recursive call.