I have this plain Object, and I have returned code from weather API, so depending on the code i want to display different HTML. The code should match one of the codeArrays and depending on the match I should have the appropriate html
var WeatherIcons = {
sunShower: {
html: '<div class="icon sun-shower"></div>',
codes: [1009, 1150, 1153, 1240, 1249]
},
thunderStorm: {
html: '<div class="icon thunder-storm"></div>',
codes: [1087, 1117, 1147, 1273, 1276, 1279]
},
cloudy: {
html: '<div class="icon cloudy"></div>',
codes: [1006, 1030, 1135]
},
snowing: {
html: '<div class="icon snowing"></div>',
codes: [1066, 1114, 1210, 1213, 1219, 1222, 1225, 1255, 1258, 1261, 1264, 1282]
},
sunny: {
html: '<div class="icon sunny"></div>',
codes: [1000, 1003, 1216]
},
rainy: {
html: '<div class="icon rainy"></div>',
codes: [1063, 1069, 1072, 1168, 1171, 1180, 1183, 1186, 1189, 1192, 1195, 1198, 1201, 1204, 1237, 1243, 1246, 1252]
}
};