DRY javascript global variable