Let's say I have a nested function named countries and I want to call two functions with one named Russia with parameter named cities1 and another named China with parameter named cities2 within the function countries. How do I call the two functions with parameters within a nested function?
function countries() {
function Russia(cities1) {
var totalpop1 = cities1 * (10 ** 6);
//each city has a population of 10^6 people
return totalpop1;
}
function China(cities2) {
var totalpop2 = cities2 * (10 ** 6);
//each city has a population of 10^6 people
return totalpop2;
}
var result = totalpop1 + totalpop2;
return result;
}
countries, then simplyRussia(809). If outside ofcountries, then you can't reach nested functions because of scope