Si verifica uno strano errore quando si tenta di passare Array.from
a Array.prototype.map
.Array.from TypeError: 0 non è una funzione
let fn = Array.from.bind(Array); // [Function: bound from]
fn('test') // [ 't', 'e', 's', 't' ]
['test'].map(s => fn(s)) // [ [ 't', 'e', 's', 't' ] ]
['test'].map(fn) // TypeError: 0 is not a function
Errore completa:
TypeError: 0 is not a function
at Function.from (native)
at Array.map (native)
at repl:1:10
at REPLServer.defaultEval (repl.js:260:27)
at bound (domain.js:287:14)
at REPLServer.runBound [as eval] (domain.js:300:12)
at REPLServer.<anonymous> (repl.js:429:12)
at emitOne (events.js:95:20)
at REPLServer.emit (events.js:182:7)
at REPLServer.Interface._onLine (readline.js:211:10)
Cosa sta succedendo?