Created
February 9, 2017 20:27
-
-
Save thacherhussain/8751a74fbf41f975b516919a48f00fe2 to your computer and use it in GitHub Desktop.
Translation Logic
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
//Top array is simulated input | |
var array = ['at&t', 'ATT', 'att', 'tmobile', 'T-mobile', 'TMobile', 'Tesla']; | |
var endArray = []; | |
for(var i = 0; i < array.length; i++) { | |
switch(array[i]){ | |
case 'at&t': | |
endArray[i] = 'AT&T'; | |
break; | |
case 'ATT': | |
endArray[i] = 'AT&T'; | |
break; | |
case 'att': | |
endArray[i] = 'AT&T'; | |
break; | |
case 'tmobile': | |
endArray[i] = 'T-Mobile'; | |
break; | |
case 'T-mobile': | |
endArray[i] = 'T-Mobile'; | |
break; | |
case 'TMobile': | |
endArray[i] = 'T-Mobile'; | |
break; | |
default: | |
endArray[i] = array[i]; | |
} | |
} | |
console.log(endArray); | |
console.log(array); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment