I'm trying to use destructuring to extract the map function from an array. The method seems to be destructured correctly. But I get the following error when I try to use it:
Uncaught TypeError: Array.prototype.map called on null or undefined
Shouldnt it be able to access the array using its scope?
const array = [1,2,3,4]
const {map} = array
console.log({map})
map(x => x*x) // Uncaught TypeError: Array.prototype.map called on null or undefined