How to map a Map
Maxence Dalmais
942

Hi, thanks for this VERY interesting article, I just wanted to point out that something may have changed and this code:

Array.from(p, [key, value] => value * value)

…is currently not working and instead raises a `Uncaught SyntaxError: Unexpected token ]` error.

The working version is as follows:

Array.from(p, ([key, value]) => value * value)

Also, another way which also works, and may be even more concise, is as follows:

[…p].map(([key, value]) => value * value)
Like what you read? Give Marco Arduini a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.