title: How to make a undo/redo function
body: <p>I want to add a <code>undo/redo</code> function in my script. I have looked around and see some suggestions, most of them recommended to use <code>command pattern</code>.</p>
  <p>The function must work over one page - after a reload of the page the function must able to <code>redo/undo</code> the last things.</p>
  <p>I don't know how command pattern works, I think about to create a object, to store the a name of the function, the old and the new value - but I'm not sure if this is a efficient way to do this or not.</p>
  <p>Maybe somebody could give me a small example how the code for a <code>undo/redo</code> function should look.</p>