My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

What's the best way to map over an Object/Array in JavaScript (ES6)?

Fernando Morris's photo
Fernando Morris
·Dec 1, 2016

Sometimes I need to map both objects properties and arrays. Since Array.map supports only arrays, I end up using lodash/map (Lodash supports both objects and arrays).

What's the recommended way to handle this?