Code
Code
io/codePrint/
appendItem(resultCountry, countryName[i]);
https://bakerfranke.github.io/codePrint/ 1/2
4/29/24, 9:19 PM bakerfranke.github.io/codePrint/
54
appendItem(integerList, i);
55
56
}
57
}
58
return resultCountry;
59
}
60
function setting(){
61
if (resultCountry.length > 0){
62
setScreen("screen2");
63
}
64
else if (resultCountry.length==0){
65
setScreen("screen3");
66
}
67
}
68
function rank(){
69
// we will traverse through different lists [resultCountry[i]] to figure out the best income, lo
70
bestIncome = 0;
71
lowUnemp = resultCountry[0];
72
lowPop = resultCountry[0];
73
for (var n = 0; n < resultCountry.length; n++){
74
if (bestIncome < countryGDPP[integerList[n]]){
75
bestIncome = countryGDPP[integerList[n]];
76
}
77
if (lowUnemp > countryUnemploymentRate[integerList[n]]){
78
lowUnemp = countryUnemploymentRate[integerList[n]];
79
}
80
if (lowPop > countryPopulation[integerList[n]]){
81
lowPop = countryPopulation[integerList[n]];
82
}
83
}
84
}
85
function wbutton (){
86
onEvent("BestIncome", "click", function(){
87
setScreen("screen4");
88
setText("screen4text", bestIncome);
89
});
90
onEvent("LowUnemp", "click", function(){
91
setScreen("screen4");
92
setText("screen4text",lowUnemp);
93
});
94
onEvent("LowPOP", "click", function(){
95
setScreen("screen4");
96
setText("screen4text", lowPop);
97
});
98
}function goBack (){
99
for (var a = 0; a < integerList.length;){
100
removeItem(integerList, integerList.length - 1);
101
removeItem(resultCountry, resultCountry.length - 1);
102
}
103
setScreen("screen1");
104
}
https://bakerfranke.github.io/codePrint/ 2/2