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

Updating map values

Let's revisit the earlier example where we called update() on a list. Inside of the update function, increment(), we used set() to change the value of map. Map was the list value that we were updating. Let's make map use the update() method as well:

const increment = map => map.update(
'total',
t => t + map.get('step')
);

Instead of having to call map.get('total'), total is passed in as the function argument.

主站蜘蛛池模板: 慈溪市| 肇东市| 乌鲁木齐市| 德兴市| 新晃| 北辰区| 司法| 双城市| 万载县| 佳木斯市| 五指山市| 沙洋县| 怀化市| 滨海县| 铜山县| 盐山县| 田东县| 白山市| 清丰县| 富阳市| 永济市| 察隅县| 泽州县| 罗江县| 垣曲县| 临安市| 新蔡县| 柏乡县| 新密市| 奈曼旗| 宁陵县| 房产| 建德市| 黄陵县| 灌南县| 肇庆市| 阜康市| 安泽县| 芮城县| 海林市| 靖宇县|