Does the .map() method have to be passed an array yeah? It can't be passed an object ?
#Javascript
#AskNostr
Does the .map() method have to be passed an array yeah? It can't be passed an object ?
#Javascript
#AskNostr
Yes, because map is part of Javascript Array built-in function. It's not available for other data type.
Technically you are passing a function that processes each item of the array.
you can call Object.keys to get an array of property names of yourObject and the use the map metod with it:
Object.keys(yourObject).map( key => doStuff(yourObject[key]))