Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
54 changes: 52 additions & 2 deletions exercise.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,52 @@
// Good Luck! You got this 💪🏾
// Write your code here.
// // Good Luck! You got this 💪🏾
// // Write your code here.
function describeCountry(country, population, capitalCity){
console.log(`${country} has ${population} million people and it's capital city is ${capitalCity}`);
}
describeCountry("Somaliland", 3.5, "Hargeisa");
describeCountry("Ethiopia", 115, "AddisAbaba");
describeCountry("Somalia", 15, "Mogadishu");

function percentageOfWorld(population){
return population / 7900 * 100
}
let populationOfMalaysia= percentageOfWorld(32)
let populationOfSingapore= percentageOfWorld(6)
let populationOfIndonesia= percentageOfWorld(273)

console.log(`Malaysia has 32 million people, so it's about ${populationOfMalaysia}% of the world population`);

console.log(`Singapore has 32 million people, so it's about ${populationOfSingapore}% of the world population`);

console.log(`Indonesia has 32 million people, so it's about ${populationOfIndonesia}% of the world population`);


let population= [12,40,30,55];
for(let i=0 ; i < 4; i++){
console.log(population[i]);
}

let neighbours=["Algeria","Niger","Chad","Mali"]
console.log(neighbours.length === 4);


for(let n=0;n<4;n++){
console.log(neighbours[n])
}
for(let n= neighbours.length-1 ;n>0;n-- ){
console.log(neighbours[n])
}


{let n = 0
while(n<neighbours.length){
console.log(neighbours[n])
n++
}}

{let n = neighbours.length -1
while(n>=0){
console.log(neighbours[n])
n--
}
}