Skip to content

Instantly share code, notes, and snippets.

@LukaszWiktor
Created September 26, 2013 09:16
Show Gist options
  • Save LukaszWiktor/6711783 to your computer and use it in GitHub Desktop.
Save LukaszWiktor/6711783 to your computer and use it in GitHub Desktop.
// traditional
if (this.currentView == 'gantt') {
this.currentView = 'table';
} else {
this.currentView = 'gantt';
}
// tricky
var toggle = {'gantt' : 'table', 'table' : 'gantt'}
this.currentView = toggle[this.currentView];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment