上QQ阅读APP看书,第一时间看更新
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.