Skip to content

Get specific elements of a Map in javascript

For a given map like this: How can I get the list of “phone”s? Something like: expected answer: [“213-555-1234”, “617-555-4321”] Answer You can directly iterate the Map object using its built-in iterator that works with a for loop. This has the advantage that it doesn&#8217…