# [JavaScript] Function Declarations vs Expressions Practice

1. The world population is 7900 million people. Create a function declaration
called 'percentageOfWorld1' which receives a 'population' value, and
returns 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 population

2. To calculate the percentage, divide the given 'population' value by 7900
and then multiply by 100

3. Call 'percentageOfWorld1' for 3 populations of countries of your choice,
store the results into variables, and log them to the console

4. Create a function expression which does the exact same thing, called
'percentageOfWorld2', and also call it with 3 country populations (can be
the same populations).

```
//1. Function Declaration
function percentageOfWorld1(population) {
    const percentage = ((population / 7900) * 100);
    return percentage;
}

const percSouthKorea1 = percentageOfWorld1(51);
const percUSA1 = percentageOfWorld1(329);
const percGermany1 = percentageOfWorld1(83);

console.log(percSouthKorea1, percUSA1, percGermany1);

//2. Function Expression
const percentageOfWorld2 = function (population) {
    const percentage = ((population / 7900) * 100);
    return percentage;
}

const percSouthKorea2 = percentageOfWorld2(51);
const percUSA2 = percentageOfWorld2(329);
const percGermany2 = percentageOfWorld2(83);

console.log(percSouthKorea2, percUSA2, percGermany2);
```

![Functions declaration vs expression Practice.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1652590389669/SUrb9VQTq.PNG align="left")

