Last active
August 21, 2019 21:52
-
-
Save tomhodgins/bd40653cb6bc2188f51e5e235b454853 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If statements | |
var headline | |
if (variation === 1) { | |
headline = 'Variation B' | |
} | |
if (variation === 2) { | |
headline = 'Variation C' | |
} | |
// Switch statement | |
var headline | |
switch (variation) { | |
case 1: | |
headline = 'Variation B' | |
break | |
case 2: | |
headline = 'Variation C' | |
break | |
} | |
// Object lookup | |
var headline = ({ | |
1: 'Variation B', | |
2: 'Variation C | |
})[variation] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment