I legit did not know you could do:
const map = new Map(Object.entries(birds));
I thought I was being sly for doing it manually with a single line reduce:
const map = Object.entries(birds).reduce( (map, [key, value]) => map.set(key, value), new Map() );
Good to know! I will have to use the shorter version the next time I need an es6 map 😉
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I legit did not know you could do:
I thought I was being sly for doing it manually with a single line reduce:
Good to know! I will have to use the shorter version the next time I need an es6 map 😉