I'm using the bluebird library to do asynchronous calls in javascript. I noticed there's a map function so I can apply a asynchronous function to each element in an array. However, I want to use this method on a object that has keys. Is there a way to do this?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
There are many way to convert an object to array like this :
Object.keys(yourObject).map(function(key){ return yourObject[key] })
You can use Promise.map too