Skip to content

Instantly share code, notes, and snippets.

@danielkellyio
Last active June 26, 2019 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielkellyio/03202a490627c8c6851e61017dd407de to your computer and use it in GitHub Desktop.
Save danielkellyio/03202a490627c8c6851e61017dd407de to your computer and use it in GitHub Desktop.
How not to set a single variable based on multiple conditions
let friendly_timezone;
if( tz_timezone === 'America/New_York' ){
friendly_timezone = 'Eastern';
}else if( tz_timezone === 'America/Chicago'){
friendly_timezone = 'Central';
}else if( tz_timezone === 'America/Denver'){
friendly_timezone = 'Mountain';
}else if( tz_timezone === 'America/Los_Angeles'){
friendly_timezone = 'Pacific';
}else{
friendly_timezone = 'No Timezone Specified';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment