Skip to content

Instantly share code, notes, and snippets.

@ecoleman
Last active August 29, 2015 14:04
Show Gist options
  • Save ecoleman/50eed4879f02469a4e5b to your computer and use it in GitHub Desktop.
Save ecoleman/50eed4879f02469a4e5b to your computer and use it in GitHub Desktop.
// load the `gameState` param from localStorage and convert it from JSON to an object
var game = JSON.parse(localStorage.getItem("gameState"));
// after the above line, you can type `game` in your console to see what properties it has
// change the `game.stores.wood` param to 15
game.stores.wood = 15;
// re-encode the game state into json and update localStorage
localStorage.setItem("gameState", JSON.stringify(game));
// reload the current window
window.location.reload();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment