August 2017
Beginner
374 pages
10h 41m
English
However, there is a different way we can store the history, that is, by tracking the past and future states in arrays and storing the present state beside them:
{ past: [...], present: ..., future: [...]}
If we try the same scenario with this kind of history, we will have the following state after three increment actions:
{ past: [0, 1, 2], present: 3, future: []}
Each undo action pushes the present state to the beginning of the future array and removes the last element from the past array, setting ...
Read now
Unlock full access