Created
October 1, 2018 21:13
-
-
Save ldco2016/fe8a49536bb545755bcce7669be8b251 to your computer and use it in GitHub Desktop.
const and let
This file contains hidden or 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
var statuses = [ | |
{ code: 'OK', response: 'Request successful' }, | |
{ code: 'FAILED', response: 'There was an error with your request' }, | |
{ code: 'PENDING', response: 'Your reqeust is still pending' } | |
]; | |
var message = ''; | |
var currentCode = 'OK'; | |
for (var i = 0; i < statuses.length; i++) { | |
if (statuses[i].code === currentCode) { | |
message = statuses[i].response; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment