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

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.

主站蜘蛛池模板: 旌德县| 佳木斯市| 乌拉特后旗| 托克逊县| 泰安市| 临颍县| 浦城县| 湾仔区| 吉隆县| 盱眙县| 定安县| 广南县| 苏尼特左旗| 桑日县| 东辽县| 绿春县| 吉林省| 喀喇沁旗| 皋兰县| 苏州市| 石城县| 贵阳市| 台南市| 平和县| 泗阳县| 云霄县| 策勒县| 蒲城县| 定安县| 井冈山市| 泰兴市| 长丰县| 太仓市| 天津市| 化隆| 通化市| 鄂托克旗| 五原县| 碌曲县| 承德县| 洱源县|