Javascript Getter and Setters; jQuery .data() function
For many kinds of games, a given character is likely to have a health level. After taking enough damage, the character's health level falls to zero, at which point the character can be seen to run some kind of death animation and it's game over. To track the health level of a given character, or to keep track of any other kind of character-relevant data for that matter (e.g. magic, experience, etc.), you can create arbitrary attributes to store data in the DOM element that represents a character. jQuery offers the short-hand .data() function, which can be called on any jQuery element and which can double as a getter and a setter, depending on how many arguments are passed into the function. We'll see this in action by hammering out some simple code to simulate a character taking damage, either as result of being attacked by enemies or as a result of being hit by the player. Check out the movie below, which features the by-now famous wingman character provided courte