官术网_书友最值得收藏!

  • Mastering Immutable.js
  • Adam Boduch
  • 179字
  • 2021-07-08 10:30:03

A collections API

A collection in JavaScript refers to anything that can be iterated over, for example, when using a for..of loop. In practice, this means arrays and objects. Arrays and objects are collections of values; the only difference between them is how you look up values. An array is an indexed collection, because you use a numerical index to lookup a value. An object is a keyed collection, because you use a key string to lookup a value.

The issue with these primitive JavaScript collection types is that they can change; that is, they're not immutable. The collections exposed by Immutable.js feel a lot like native arrays and objects. In fact, you can take an array or an object and use it to construct an Immutable.js collection. You can also turn an Immutable.js collection into a JavaScript array or object.

This is the extent of the Immutable.js API. You use collection classes to hold your immutable data. To use this immutable data, you call methods on these collections, which is at the very heart of the Immutable.js API.

主站蜘蛛池模板: 宜州市| 顺平县| 伊川县| 通海县| 岱山县| 喀什市| 新蔡县| 米泉市| 肥东县| 偏关县| 宁明县| 保山市| 丰原市| 大渡口区| 翁牛特旗| 上思县| 东乡| 沅陵县| 客服| 韶关市| 尖扎县| 海晏县| 南和县| 新余市| 临湘市| 镇雄县| 隆昌县| 峨眉山市| 凤翔县| 沧源| 高密市| 海安县| 卢氏县| 疏附县| 彰武县| 五台县| 福州市| 雷州市| 天峨县| 瑞金市| 犍为县|