console.log(1)
console.log(2)
console.log(3)
console.log(4)
console.log(5)
[1, 2, 3, 4, 5]
const consoleArray = Object.keys(console).filter(
k => typeof console[k] === 'function'
).reduce(
([cnsl, acc], key) => [Object.assign(cnsl, {
[key]: (original => (...args) => (
acc.push(...args),
original.call(cnsl, acc)
))(cnsl[key])
}), acc],
[console, []]
)[1];
let arr = [1, 2, 3, 4, 5]
function getConsoleLog(arr){
for (const i = 0; i < arr.length; i++){
return console.log(arr[i])
}
}
getConsoleLog(arr);
consoleArray = []
function log(xyi) {
consoleArray.push(xyi)
console.log(xyi)
}
log(4)
log(5)