From 6d55502e7e1c4f4ce68db7491c7944e3417e940d Mon Sep 17 00:00:00 2001 From: mohan omar Date: Wed, 16 Nov 2022 21:47:55 +0300 Subject: [PATCH] answered --- exercise.js | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/exercise.js b/exercise.js index da0af63..409ad3e 100644 --- a/exercise.js +++ b/exercise.js @@ -1,2 +1,54 @@ -// Good Luck! You got this 💪🏾 -// Write your code here. + +function describeCountry (country,population,capitalCity){ + return `${country} has ${population} million peaple and its capital city is ${capitalCity}` +} +describeCountry("somaliland",3.5,"Hargeisa") + +let country = describeCountry("somaliland",3.5,"Hargeisa") +let country2 = describeCountry("kenya",50,"nairobi") +let country3 = describeCountry("uganda",30,"kambala") +let country4 = describeCountry("jaibuti",2.5,"jaibuti") +console.log(country) +console.log(country2) +console.log(country3) +console.log(country4) + +function percentageOfWorld1 (population){ + return population / 79000000000 * 100 +} +percentageOfWorld1(160000000) + +let populationofsomalia = percentageOfWorld1(160000000) +let populationofkenya = percentageOfWorld1(510000000) +let populationofsomaliland = percentageOfWorld1(2000000) +console.log(populationofsomalia) +console.log(populationofkenya) +console.log(populationofsomaliland) + +let population = [10000000,250000000,450000000,670000000,] +let neighbours =["kenya","ethobia","jaibuti","yeman",] +console.log(population) +console.log(neighbours) + +let elements = true +console.log(elements) + + +for(let i=0; i <=3; i++){ + console.log(neighbours[i]) +} +for(let i = 3; i >=0 ; i--){ + console.log(neighbours[i]) +} + + +let b=0; +while(b<=3){ + console.log(neighbours[b]) + b++ +} +let I=3; +while(I>=0){ + console.log(neighbours[I]) + I-- +} \ No newline at end of file