Three quick ways to convert objects to arrays
Easily convert objects to arrays and iterate to your heart’s content. There are multiple ways of converting an object to an array (which, also is an object but a different one at that.) Method 1: A simple Object.values() method The first idea that comes to mind is to just use Object.keys(), Object.values() or Object.entries() to generate an array. const numO = { a: 1, b: 2, c: 3, d: 4, e: 5 }; console.log(Object.values(numO)); // [ 1, 2, 3, 4, 5 ] Method 2: Apply transformation logic during object to array conversion If you are going fancy about the conversion and want to include some logic therein - ...