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

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.

主站蜘蛛池模板: 克山县| 和平县| 罗甸县| 自治县| 吕梁市| 阜城县| 五寨县| 文水县| 兴安盟| 长春市| 哈尔滨市| 沈阳市| 宜川县| 廉江市| 万载县| 西吉县| 江永县| 徐州市| 北票市| 吴堡县| 交城县| 册亨县| 林口县| 和硕县| 鱼台县| 安达市| 凯里市| 正镶白旗| 腾冲县| 淄博市| 彭山县| 墨玉县| 甘孜| 二连浩特市| 麟游县| 辰溪县| 重庆市| 陇川县| 互助| 图片| 阿拉善盟|