- Write a function called 'describeCountry' which takes three parameters:
country,populationandcapitalCity. Based on this input, the function returns a string with this format: 'Somaliland has 3.5 million people and its captial city is Hargeisa' - Call the function 3 times with input data for 3 different countries. store the return values in 3 different variables and log them to the console.
- The world population is 7900 million people. Create a function called
percentageOfWorld1which recieves apopulationvalue and reutnrs the percentage of the world population that the given population represents. For example, China has 1441 million people, so it's about 18.2% of the world populationNOTE: To calculate the percentage, divide the given
populationvalue by 7900 and then multiply by 100 - Call
percentageOfWorld1for 3 populations of countries of your choice, store the results into variables, and log them to the console
- Create an array containing 4 population values of 4 countries of your choice and store it in a varaible called
population - Create an array containing all the neighbouring countries of a country of your choice. Store the array into a varaible called
neighbours - Log to the console whether the array has 4 elements or not (true or false)
- Console log one by one the countries inside the
neighboursarray. - Console log one by one the countries inside the
neighboursarray but this time in a reverse order.
- Do exercise 8 & 9 using while loop