The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Differences between the Immutable.js Map() and List()

Differences between the Immutable.js Map() and List()

4:02
The Immutable.js Map() is analogous to a Javascript Object or Hash since it is comprised of key-value pairs. The Immutable.js List() is analogous to a Javascript Array and contains many of the same native methods. Let's compare the two and dive into the basics of List().
Watch this lesson now
Avatar
egghead.io

The Immutable.js Map() is analogous to a Javascript Object or Hash since it is comprised of key-value pairs. The Immutable.js List() is analogous to a Javascript Array and contains many of the same native methods. Let's compare the two and dive into the basics of List().

Avatar
Lee

Nice use of a rest operator for List.of, although this example could be simplified with Immutable.List(array) (i.e. no need to use the of function)

In reply to egghead.io
Avatar
Sean Inglis

Note that if you're using _.each to iterate over an array, there's no need to manually manage the index with a count; it's supplied as a second parameter to your iterated function (and the full array itself is provided as a 3rd).

Avatar
J.S.

Hey Sean and Lee! You are both right! I use those conventions in other videos. Not sure why I used the closure var count there... must have been a brain flub. :P Thanks for the feedback!

In reply to Sean Inglis
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?