Skip to content

Error: expecting an array, a promise or a thenable

petkaantonov edited this page Dec 28, 2014 · 2 revisions

Error: expecting an array, a promise or a thenable

This error message usually happens when trying to work with collections but passing a single element instead.

For example:

function returnThree(){ return 3;}

Promise.resolve(5).map(returnThree).then(function(val){
    console.log("Hello Value!",val); 
});

The map operation is expecting an array here (or a promise on one) and instead gets the number 5.