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

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.

主站蜘蛛池模板: 漯河市| 鸡泽县| 招远市| 咸丰县| 西充县| 磐安县| 临夏市| 巍山| 涞水县| 南乐县| 洛阳市| 黔东| 孟连| 休宁县| 阳曲县| 武邑县| 镇雄县| 綦江县| 闸北区| 琼结县| 丰县| 保山市| 翼城县| 平遥县| 崇左市| 林州市| 宣化县| 聂拉木县| 西充县| 祁东县| 界首市| 南阳市| 盈江县| 兴城市| 南充市| 济源市| 马公市| 普安县| 延津县| 桑日县| 上虞市|