Using Object.entries to get iterable property-name pairs

Object.assign works well for copying properties from one object to another. However, we sometimes want to perform other operations based on the properties of an object. This recipe shows how to use Object.entries to get an iterable of an object's properties.

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.