diff --git a/.gitignore b/.gitignore index 62f509c1..5eb48b48 100644 --- a/.gitignore +++ b/.gitignore @@ -14,8 +14,8 @@ day9.md day10.md 01_02_03_days_backup.md test.md -08_Day 09_Day 10_Day 11_Day -12_Day \ No newline at end of file +12_Day +test.html \ No newline at end of file diff --git a/05_Day/05_day_arrays.md b/05_Day/05_day_arrays.md index 164db375..c1a795f2 100644 --- a/05_Day/05_day_arrays.md +++ b/05_Day/05_day_arrays.md @@ -59,6 +59,7 @@ An array is a collection of different data types which are ordered and changeabl ### How to create an empty array In JavaScript, we can create an array in different ways. Let us different ways to create an array. +It is very common to use *const* instead of *let* to declare an array variable. If you ar using const it means you do not use that name again. - Using Array constructor diff --git a/07_Day/07_day_functions.md b/07_Day/07_day_functions.md index 87625636..3fa2e122 100644 --- a/07_Day/07_day_functions.md +++ b/07_Day/07_day_functions.md @@ -552,14 +552,21 @@ console.log('Weight of an object in Newton: ', weightOfObject(100, 1.62)) // gra ``` 18. Declare a function name _printArray_. It takes array as a parameter and it prints out each value of the array. -19. Declare a function name _swapValues_. This function swaps value of x to y. +19. 11. Write a function name _showDateTime_ which shows time in this format: 08/01/2020 04:08 using the Date object. + + ```sh + showDateTime() + 08/01/2020 04:08 + ``` + +20. Declare a function name _swapValues_. This function swaps value of x to y. ```js swapValues(3, 4) // x => 4, y=>3 swapValues(4, 5) // x = 5, y = 4 ``` -20. Declare a function name _reverseArray_. It takes array as a parameter and it returns the reverse of the array (don't use method). +21. Declare a function name _reverseArray_. It takes array as a parameter and it returns the reverse of the array (don't use method). ```js console.log(reverseArray([1, 2, 3, 4, 5])) @@ -568,13 +575,13 @@ console.log('Weight of an object in Newton: ', weightOfObject(100, 1.62)) // gra //['C', 'B', 'A'] ``` -21. Declare a function name _capitalizeArray_. It takes array as a parameter and it returns the - capitalizedarray. -22. Declare a function name _addItem_. It takes an item parameter and it returns an array after adding the item -23. Declare a function name _removeItem_. It takes an index parameter and it returns an array after removing an item -24. Declare a function name _sumOfNumbers_. It takes a number parameter and it adds all the numbers in that range. -25. Declare a function name _sumOfOdds_. It takes a number parameter and it adds all the odd numbers in that - range. -26. Declare a function name _sumOfEven_. It takes a number parameter and it adds all the even numbers in that - range. -27. Declare a function name evensAndOdds . It takes a positive integer as parameter and it counts number of evens and odds in the number. +22. Declare a function name _capitalizeArray_. It takes array as a parameter and it returns the - capitalizedarray. +23. Declare a function name _addItem_. It takes an item parameter and it returns an array after adding the item +24. Declare a function name _removeItem_. It takes an index parameter and it returns an array after removing an item +25. Declare a function name _sumOfNumbers_. It takes a number parameter and it adds all the numbers in that range. +26. Declare a function name _sumOfOdds_. It takes a number parameter and it adds all the odd numbers in that - range. +27. Declare a function name _sumOfEven_. It takes a number parameter and it adds all the even numbers in that - range. +28. Declare a function name evensAndOdds . It takes a positive integer as parameter and it counts number of evens and odds in the number. ```sh evensAndOdds(100); @@ -582,30 +589,30 @@ console.log('Weight of an object in Newton: ', weightOfObject(100, 1.62)) // gra The number of evens are 51. ``` -28. Write a function which takes any number of arguments and return the sum of the arguments +29. Write a function which takes any number of arguments and return the sum of the arguments ```js sum(1, 2, 3) // -> 6 sum(1, 2, 3, 4) // -> 10 ``` -29. Writ a function which generates a _randomUserIp_. -30. Write a function which generates a _randomMacAddress_ -31. Declare a function name _randomHexaNumberGenerator_. When this function is called it generates a random hexadecimal number. The function return the hexadecimal number. +30. Writ a function which generates a _randomUserIp_. +31. Write a function which generates a _randomMacAddress_ +32. Declare a function name _randomHexaNumberGenerator_. When this function is called it generates a random hexadecimal number. The function return the hexadecimal number. ```sh console.log(randomHexaNumberGenerator()); '#ee33df' ``` -32. Declare a function name _userIdGenerator_. When this function is called it generates seven character id. The function return the id. +33. Declare a function name _userIdGenerator_. When this function is called it generates seven character id. The function return the id. ```sh console.log(userIdGenerator()); 41XTDbE ``` -33. Modify question number n . Declare a function name _userIdGeneratedByUser_. It doesn’t take any parameter but it takes two inputs using prompt(). One of the input is the number of characters and the second input is the number of ids which are supposed to be generated. +34. Modify question number n . Declare a function name _userIdGeneratedByUser_. It doesn’t take any parameter but it takes two inputs using prompt(). One of the input is the number of characters and the second input is the number of ids which are supposed to be generated. ```sh userIdGeneratedByUser() @@ -624,18 +631,18 @@ console.log('Weight of an object in Newton: ', weightOfObject(100, 1.62)) // gra ' ``` -34. Write a function name _rgbColorGenerator_ and it generates rgb colors. +35. Write a function name _rgbColorGenerator_ and it generates rgb colors. ```sh rgbColorGenerator() rgb(125,244,255) ``` -35. Write a function **_arrayOfHexaColors_** which return any number of hexadecimal colors in an array. -36. Write a function **_arrayOfRgbColors_** which return any number of RGB colors in an array. -37. Write a function **_convertHexaToRgb_** which converts hexa color to rgb and it returns an rgb color. -38. Write a function **_convertRgbToHexa_** which converts rgb to hexa color and it returns an hexa color. -39. Write a function **_generateColors_** which can generate any number of hexa or rgb colors. +36. Write a function **_arrayOfHexaColors_** which return any number of hexadecimal colors in an array. +37. Write a function **_arrayOfRgbColors_** which return any number of RGB colors in an array. +38. Write a function **_convertHexaToRgb_** which converts hexa color to rgb and it returns an rgb color. +39. Write a function **_convertRgbToHexa_** which converts rgb to hexa color and it returns an hexa color. +40. Write a function **_generateColors_** which can generate any number of hexa or rgb colors. ```js console.log(generateColors('hexa', 3)) // ['#a3e12f', '#03ed55', '#eb3d2b'] @@ -644,13 +651,13 @@ console.log('Weight of an object in Newton: ', weightOfObject(100, 1.62)) // gra console.log(generateColors('rgb', 1)) // 'rgb(33,79, 176)' ``` -40. Call your function _shuffleArray_, it takes an array as a parameter and it returns a shuffled array -41. Call your function _factorial_, it takes a whole number as a parameter and it return a factorial of the number -42. Call your function _isEmpty_, it takes a parameter and it checks if it is empty or not -43. Call your function _sum_, it takes any number of arguments and it returns the sum. -44. Write a function called _sumOfArrayItems_, it takes an array parameter and return the sum of all the items. Check if all the array items are number types. If not give return reasonable feedback. -45. Write a function called _average_, it takes an array parameter and returns the average of the items. Check if all the array items are number types. If not give return reasonable feedback. -46. Write a function called _modifyArray_ takes array as parameter and modifies the fifth item of the array and return the array. If the array length is less than five it return 'item not found'. +41. Call your function _shuffleArray_, it takes an array as a parameter and it returns a shuffled array +42. Call your function _factorial_, it takes a whole number as a parameter and it return a factorial of the number +43. Call your function _isEmpty_, it takes a parameter and it checks if it is empty or not +44. Call your function _sum_, it takes any number of arguments and it returns the sum. +45. Write a function called _sumOfArrayItems_, it takes an array parameter and return the sum of all the items. Check if all the array items are number types. If not give return reasonable feedback. +46. Write a function called _average_, it takes an array parameter and returns the average of the items. Check if all the array items are number types. If not give return reasonable feedback. +47. Write a function called _modifyArray_ takes array as parameter and modifies the fifth item of the array and return the array. If the array length is less than five it return 'item not found'. ```js console.log(modifyArray(['Avocado', 'Tomato', 'Potato','Mango', 'Lemon','Carrot']); @@ -661,17 +668,17 @@ console.log('Weight of an object in Newton: ', weightOfObject(100, 1.62)) // gra // →'Not Found' ``` -47. Write a function called _isPrime_, which checks if a number is prime number. -48. Write a functions which checks if all items are unique in the array. -49. Write a function which checks if all the items of the array are the same data type. -50. JavaScript variable name does not support special characters or symbols except \$ or \_. Write a function **\*isValidVariable** which check if a variable is valid or invalid variable. -51. Write a function which returns array of seven random numbers in a range of 0-9. All the numbers must be unique. +48. Write a function called _isPrime_, which checks if a number is prime number. +49. Write a functions which checks if all items are unique in the array. +50. Write a function which checks if all the items of the array are the same data type. +51. JavaScript variable name does not support special characters or symbols except \$ or \_. Write a function **\*isValidVariable** which check if a variable is valid or invalid variable. +52. Write a function which returns array of seven random numbers in a range of 0-9. All the numbers must be unique. ```js sevenRandomNumbers()[(1, 4, 5, 7, 9, 8, 0)] ``` -52. Write a function called reverseCountries, it takes countries array and first it copy the array and returns the reverse of the original array +53. Write a function called reverseCountries, it takes countries array and first it copy the array and returns the reverse of the original array 🎉 CONGRATULATIONS ! 🎉 diff --git a/07_Day/07_day_starter/index.html b/07_Day/07_day_starter/index.html index c620ee35..f7eb67c4 100644 --- a/07_Day/07_day_starter/index.html +++ b/07_Day/07_day_starter/index.html @@ -7,7 +7,7 @@

30DaysOfJavaScript:07 Day

-

Loops

+

Functions

diff --git a/08_Day/08_day_objects.md b/08_Day/08_day_objects.md new file mode 100644 index 00000000..d8a258f7 --- /dev/null +++ b/08_Day/08_day_objects.md @@ -0,0 +1,580 @@ +
+

30 Days Of JavaScript

+ + GitHub stars + + + + + + Twitter Follow + + +Author: +Asabeneh Yetayeh
+ January, 2020 +
+ +
+ +[<< Day 7](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/09_Day/09_day_function_programming.md) | [Day 9 >>](#) + +![Thirty Days Of JavaScript](../images/banners/day_1_7.png) + +- [Day 8](#day-8) + - [Scope](#scope) + - [Window Scope](#window-scope) + - [Global scope](#global-scope) + - [Local scope](#local-scope) + - [📔 Object](#%f0%9f%93%94-object) + - [Creating an empty object](#creating-an-empty-object) + - [Creating an objecting with values](#creating-an-objecting-with-values) + - [Getting values from an object](#getting-values-from-an-object) + - [Creating object methods](#creating-object-methods) + - [Setting new key for an object](#setting-new-key-for-an-object) + - [Object Methods](#object-methods) + - [Getting object keys using Object.keys()](#getting-object-keys-using-objectkeys) + - [Getting object values using Object.values()](#getting-object-values-using-objectvalues) + - [Getting object keys and values using Object.entries()](#getting-object-keys-and-values-using-objectentries) + - [Checking properties using hasOwnProperty()](#checking-properties-using-hasownproperty) + - [💻 Exercises](#%f0%9f%92%bb-exercises) + +# Day 8 + +## Scope + +Variable is the fundamental part in programming. We declare variable to store different data types. To declare a variable we use the key word _var_, _let_ and _const_. A variable can declared at different scope. In this section we will see the scope, scope of variables when we use var or let. +Variables scopes can be: + +- Window +- Global +- Local + +Variable can be declared globally or locally or window scope. We will see both global and local scope. +Anything declared without let, var or const is scoped at window level. + +Let us image we have a scope.js file. + +### Window Scope + +Without using console.log() open your browser and check, you will see the value of a and b if you write a or b on the browser. That means a and b are already available in the window. + +```js +//scope.js +a = 'JavaScript' // is a window scope this found anywhere +b = 10 // this is a window scope variable +function letsLearnScope() { + console.log(a, b) + if (true) { + console.log(a, b) + } +} +console.log(a, b) // accessible +``` + +### Global scope + +A globally declared variable can be access every where in the same file. But the term global is relative. It can be global to the file or it can be global relative to some block of codes. + +```js +//scope.js +let a = 'JavaScript' // is a global scope it will be found anywhere in this file +let b = 10 // is a global scope it will be found anywhere in this file +function letsLearnScope() { + console.log(a, b) // JavaScript 10, accessible + if (true) { + let a = 'Python' + let b = 100 + console.log(a, b) // Python 100 + } + console.log(a, b) +} +letsLearnScope() +console.log(a, b) // JavaScript 10, accessible +``` + +### Local scope + +A local declared variable can be access only certain block code. + +```js +//scope.js +let a = 'JavaScript' // is a global scope it will be found anywhere in this file +let b = 10 // is a global scope it will be found anywhere in this file +function letsLearnScope() { + console.log(a, b) // JavaScript 10, accessible + let c = 30 + if (true) { + // we can access from the function and outside the function but + // variables declared inside the if will not be accessed outside the if block + let a = 'Python' + let b = 20 + let d = 40 + console.log(a, b, c) // Python 20 30 + } + // we can not access c because c's scope is only the if block + console.log(a, b) +} +letsLearnScope() +console.log(a, b) // JavaScript 10, accessible +``` + +Now, you have an understanding of scope. A variable declared with *var* only scoped to function but variable declared with *let* or *const* is block scope(function block, if block, loop etc) + +```js +//scope.js +function letsLearnScope() { + var gravity = 9.81 + console.log(gravity) + +} +// console.log(gravity), Uncaught ReferenceError: gravity is not defined + +if (true){ + var gravity = 9.81 + console.log(gravity) // 9.81 +} +console.log(gravity) // 9.81 + +for(var i = 0; i < 3; i++){ + console.log(i) // 1, 2, 3 +} +console.log(i) + +``` + +In ES6 and above there is *let* and *const*, so you will suffer from the sneakiness of *var*. When we use *let* our variable is block scope and it will not infect other parts of our code. + +```js +//scope.js +function letsLearnScope() { + // you can use let or const, but gravity is constant I prefer to use const + const gravity = 9.81 + console.log(gravity) + +} +// console.log(gravity), Uncaught ReferenceError: gravity is not defined + +if (true){ + const gravity = 9.81 + console.log(gravity) // 9.81 +} +// console.log(gravity), Uncaught ReferenceError: gravity is not defined + +for(let i = 0; i < 3; i++){ + console.log(i) // 1, 2, 3 +} +// console.log(i), Uncaught ReferenceError: gravity is not defined + +``` + +The scope *let* and *const* is the same. The difference is only reassigning. We can not change or reassign the value of const variable. + +## 📔 Object + +Everything can be an object and objects do have properties and properties have values. +Creating an object literal. To create an object literal, we use two curly brackets. + +### Creating an empty object + +An empty object + +```js +const person = {} +``` + +### Creating an objecting with values + +Now, the person object has firstName, lastName, age, location, skills and isMarried properties. The value of properties or keys could be a string, number, boolean, an object, null, undefined or a function. + +Let us see some examples of object. Each key has a value in object. + +```js +const rectangle = { + length: 20, + width: 20 +} +console.log(rectangle) // {length: 20, width: 20} + +const person = { + firstName: 'Asabeneh', + lastName: 'Yetayeh', + age: 250, + country: 'Finland', + city: 'Helsinki', + skills: [ + 'HTML', + 'CSS', + 'JavaScript', + 'React', + 'Node', + 'MongoDB', + 'Python', + 'D3.js' + ], + isMarried: true +} +console.log(person) +``` + +### Getting values from an object + +We can access values of object using two methods: + +- using . followed by key name if the key-name is a one word +- using square bracket and a quote + +```js +const person = { + firstName: 'Asabeneh', + lastName: 'Yetayeh', + age: 250, + country: 'Finland', + city: 'Helsinki', + skills: [ + 'HTML', + 'CSS', + 'JavaScript', + 'React', + 'Node', + 'MongoDB', + 'Python', + 'D3.js' + ], + getFullName: function() { + return `${this.firstName}${this.lastName}` + }, + 'phone number': '+3584545454545' +} + +// accessing values using . +console.log(person.firstName) +console.log(person.lastName) +console.log(person.age) +console.log(person.location) + +// value can be accessed using square bracket and key name +console.log(person['firstName']) +console.log(person['lastName']) +console.log(person['age']) +console.log(person['age']) +console.log(person['location']) + +// for instance to access the phone number we only use the square bracket method +console.log(person['phone number']) +``` + +### Creating object methods + +Now, the person object has getFullName properties. The getFullName is function inside the person object and we call it an object method. The _this_ key word refers to the object itself. We can use the word _this_ to access the values of different properties of the object. We can not use an arrow function as object method because the word this refers to the window inside an arrow function instead of the object itself. Example of object: + +```js +const person = { + firstName: 'Asabeneh', + lastName: 'Yetayeh', + age: 250, + country: 'Finland', + city: 'Helsinki', + skills: [ + 'HTML', + 'CSS', + 'JavaScript', + 'React', + 'Node', + 'MongoDB', + 'Python', + 'D3.js' + ], + getFullName: function() { + return `${this.firstName} ${this.lastName}` + } +} + +console.log(person.getFullName()) +// Asabeneh Yetayeh +``` + +### Setting new key for an object + +An object is a mutable data structure and we can modify the content of an object after it gets created. + +Setting a new keys in an object + +```js +const person = { + firstName: 'Asabeneh', + lastName: 'Yetayeh', + age: 250, + country: 'Finland', + city: 'Helsinki', + skills: [ + 'HTML', + 'CSS', + 'JavaScript', + 'React', + 'Node', + 'MongoDB', + 'Python', + 'D3.js' + ], + getFullName: function() { + return `${this.firstName} ${this.lastName}` + } +} +person.nationality = 'Ethiopian' +person.country = 'Finland' +person.title = 'teacher' +person.skills.push('Meteor') +person.skills.push('SasS') +person.isMarried = true + +person.getPersonInfo = function() { + let skillsWithoutLastSkill = this.skills + .splice(0, this.skills.length - 1) + .join(', ') + let lastSkill = this.skills.splice(this.skills.length - 1)[0] + + let skills = `${skillsWithoutLastSkill}, and ${lastSkill}` + let fullName = this.getFullName() + let statement = `${fullName} is a ${this.title}.\nHe lives in ${this.country}.\nHe teaches ${skills}.` + return statement +} +console.log(person) +console.log(person.getPersonInfo()) +``` + +```sh +Asabeneh Yetayeh is a teacher. +He lives in Finland. +He teaches HTML, CSS, JavaScript, React, Node, MongoDB, Python, D3.js, Meteor, and SasS. +``` + +### Object Methods + +There are different methods to manipulate an object. Let us see some of the available methods. + +_Object.assign_: To copy an object without modifying the original object + +```js +const person = { + name: 'Asabeneh', + age: 200, + country: 'Finland', + skills: ['HTML', 'CSS', 'JS'], + title: 'teacher', + address: { + street: 'Heitamienkatu 16', + pobox: 2002, + city: 'Helsinki' + }, + getPersonInfo: function() { + return `I am ${this.name} and I live in ${this.country}. I am ${this.age}.` + } +} + +//Object methods: Object.assign, Object.keys, Object.values, Object.entries +//hasOwnProperty + +const copyPerson = Object.assign({}, person) +console.log(copyPerson) +``` + +#### Getting object keys using Object.keys() + +_Object.keys_: To get the keys or properties of an object as an array + +```js +const keys = Object.keys(copyPerson) +console.log(keys) //['name', 'age', 'country', 'skills', 'address', 'getPersonInfo'] +const address = Object.keys(copyPerson.address) +console.log(address) //['street', 'pobox', 'city'] +``` + +#### Getting object values using Object.values() + +_Object.values_:To get values of an object as an array + +```js +const values = Object.values(copyPerson) +console.log(values) +``` + +#### Getting object keys and values using Object.entries() + +_Object.entries_:To get the keys and values in an array + +```js +const entries = Object.entries(copyPerson) +console.log(entries) +``` + +#### Checking properties using hasOwnProperty() + +_hasOwnProperty_: To check if a specific key or property exist in an object + +```js +console.log(copyPerson.hasOwnProperty('name')) +console.log(copyPerson.hasOwnProperty('score')) +``` + +## 💻 Exercises + +1. Create an empty object called dog +1. Print the the dog object on the console +1. Add name, legs, color, age and bark properties for the dog object. The bark property is a method which return _woof woof_ +1. Get name, legs, color, age and bark value from the dog object +1. Set new properties the dog object: breed, getDogInfo +1. Create an object literal called _personAccount_. It has _firstName, lastName, incomes, expenses_ properties and it has _totalIncome, totalExpense, accountInfo,addIncome, addExpense_ and _accountBalance_ methods. Incomes is a set of incomes and its description and expenses is a set of incomes and its description. +1. Count logged in users,count users having greater than equal to 50 points from the following object. + + ````js + const users = { + Alex: { + email: 'alex@alex.com', + skills: ['HTML', 'CSS', 'JavaScript'], + age: 20, + isLoggedIn: false, + points: 30 + }, + Asab: { + email: 'asab@asab.com', + skills: ['HTML', 'CSS', 'JavaScript', 'Redux', 'MongoDB', 'Express', 'React', 'Node'], + age: 25, + isLoggedIn: false, + points: 50 + }, + Brook: { + email: 'daniel@daniel.com', + skills: ['HTML', 'CSS', 'JavaScript', 'React', 'Redux'], + age: 30, + isLoggedIn: true, + points: 50 + }, + Daniel: { + email: 'daniel@alex.com', + skills: ['HTML', 'CSS', 'JavaScript', 'Python'], + age: 20, + isLoggedIn: false, + points: 40 + }, + John: { + email: 'john@john.com', + skills: ['HTML', 'CSS', 'JavaScript', 'React', 'Redux', 'Node.js'], + age: 20, + isLoggedIn: true, + points: 50 + }, + Thomas: { + email: 'thomas@thomas.com', + skills: ['HTML', 'CSS', 'JavaScript', 'React'], + age: 20, + isLoggedIn: false, + points: 40 + }, + Paul: { + email: 'paul@paul.com', + skills: ['HTML', 'CSS', 'JavaScript', 'MongoDB', 'Express', 'React', 'Node'], + age: 20, + isLoggedIn: false, + points: 40 + } + }``` + + ```` + +1. Find people who are MERN stack developer from the users object +1. Set your name in the users object without modifying the original users object +1. Get all keys or properties of users object +1. Get all the values of users object +1. Use the countries object to print a country name, capital, populations and languages. +1. \*\*\* Find the 10 most spoken languages: + + ````js + // Your output should look like this + console.log(mostSpokenLanguages(countries, 10)) + [(91, 'English'), + (45, 'French'), + (25, 'Arabic'), + (24, 'Spanish'), + (9, 'Russian'), + (9, 'Portuguese'), + (8, 'Dutch'), + (7, 'German'), + (5, 'Chinese'), + (4, 'Swahili'), + (4, 'Serbian')] + + // Your output should look like this + console.log(mostSpokenLanguages(countries, 3)) + [ + (91, 'English'), + (45, 'French'), + (25, 'Arabic') + ]``` + + ```` + +1. \*\*\* Use countries_data.js file create a function which create the ten most populated countries + + ````js + console.log(mostPopulatedCountries(countries, 10)) + + [ + {country: 'China', population: 1377422166}, + {country: 'India', population: 1295210000}, + {country: 'United States of America', population: 323947000}, + {country: 'Indonesia', population: 258705000}, + {country: 'Brazil', population: 206135893}, + {country: 'Pakistan', population: 194125062}, + {country: 'Nigeria', population: 186988000}, + {country: 'Bangladesh', population: 161006790}, + {country: 'Russian Federation', population: 146599183}, + {country: 'Japan', population: 126960000} + ] + + console.log(mostPopulatedCountries(countries, 3)) + [ + {country: 'China', population: 1377422166}, + {country: 'India', population: 1295210000}, + {country: 'United States of America', population: 323947000} + ]``` + + ```` + +1. \*\*\* Try to develop a program which calculate measure of central tendency of a sample(mean, median, mode) and measure of variability(range, variance, standard deviation). In addition to those measures find the min, max, count, percentile, and frequency distribution of the sample. You can create an object called statistics and create all the functions which do statistical calculations as method for the statistics object. Check the output below. + + ```js + const ages = [31, 26, 34, 37, 27, 26, 32, 32, 26, 27, 27, 24, 32, 33, 27, 25, 26, 38, 37, 31, 34, 24, 33, 29, 26] + + console.log('Count:', statistics.count()) // 25 + console.log('Sum: ', statistics.sum()) // 744 + console.log('Min: ', statistics.min()) // 24 + console.log('Max: ', statistics.max()) // 38 + console.log('Range: ', statistics.range() // 14 + console.log('Mean: ', statistics.mean()) // 30 + console.log('Median: ',statistics.median()) // 29 + console.log('Mode: ', statistics.mode()) // {'mode': 26, 'count': 5} + console.log('Variance: ',statistics.var()) // 17.5 + console.log('Standard Deviation: ', statistics.std()) // 4.2 + console.log('Variance: ',statistics.var()) // 17.5 + console.log('Frequency Distribution: ',statistics.freqDist()) # [(20.0, 26), (16.0, 27), (12.0, 32), (8.0, 37), (8.0, 34), (8.0, 33), (8.0, 31), (8.0, 24), (4.0, 38), (4.0, 29), (4.0, 25)] + ``` + + ```sh + console.log(statistics.describe()) + Count: 25 + Sum: 744 + Min: 24 + Max: 38 + Range: 14 + Mean: 30 + Median: 29 + Mode: (26, 5) + Variance: 17.5 + Standard Deviation: 4.2 + Frequency Distribution: [(20.0, 26), (16.0, 27), (12.0, 32), (8.0, 37), (8.0, 34), (8.0, 33), (8.0, 31), (8.0, 24), (4.0, 38), (4.0, 29), (4.0, 25)] + ``` + +🎉 CONGRATULATIONS ! 🎉 + +[<< Day 7](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/09_Day/09_day_function_programming.md) | [Day 9 >>](#) diff --git a/08_Day/08_day_starter/data/countries_obj.js b/08_Day/08_day_starter/data/countries_obj.js new file mode 100644 index 00000000..92acddd2 --- /dev/null +++ b/08_Day/08_day_starter/data/countries_obj.js @@ -0,0 +1,2013 @@ +const countries = [ + { + name: 'Afghanistan', + capital: 'Kabul', + languages: ['Pashto', 'Uzbek', 'Turkmen'], + population: 27657145, + flag: 'https://restcountries.eu/data/afg.svg', + currency: 'Afghan afghani' + }, + { + name: 'Åland Islands', + capital: 'Mariehamn', + languages: ['Swedish'], + population: 28875, + flag: 'https://restcountries.eu/data/ala.svg', + currency: 'Euro' + }, + { + name: 'Albania', + capital: 'Tirana', + languages: ['Albanian'], + population: 2886026, + flag: 'https://restcountries.eu/data/alb.svg', + currency: 'Albanian lek' + }, + { + name: 'Algeria', + capital: 'Algiers', + languages: ['Arabic'], + population: 40400000, + flag: 'https://restcountries.eu/data/dza.svg', + currency: 'Algerian dinar' + }, + { + name: 'American Samoa', + capital: 'Pago Pago', + languages: ['English', 'Samoan'], + population: 57100, + flag: 'https://restcountries.eu/data/asm.svg', + currency: 'United State Dollar' + }, + { + name: 'Andorra', + capital: 'Andorra la Vella', + languages: ['Catalan'], + population: 78014, + flag: 'https://restcountries.eu/data/and.svg', + currency: 'Euro' + }, + { + name: 'Angola', + capital: 'Luanda', + languages: ['Portuguese'], + population: 25868000, + flag: 'https://restcountries.eu/data/ago.svg', + currency: 'Angolan kwanza' + }, + { + name: 'Anguilla', + capital: 'The Valley', + languages: ['English'], + population: 13452, + flag: 'https://restcountries.eu/data/aia.svg', + currency: 'East Caribbean dollar' + }, + { + name: 'Antarctica', + capital: '', + languages: ['English', 'Russian'], + population: 1000, + flag: 'https://restcountries.eu/data/ata.svg', + currency: 'Australian dollar' + }, + { + name: 'Antigua and Barbuda', + capital: "Saint John's", + languages: ['English'], + population: 86295, + flag: 'https://restcountries.eu/data/atg.svg', + currency: 'East Caribbean dollar' + }, + { + name: 'Argentina', + capital: 'Buenos Aires', + languages: ['Spanish', 'Guaraní'], + population: 43590400, + flag: 'https://restcountries.eu/data/arg.svg', + currency: 'Argentine peso' + }, + { + name: 'Armenia', + capital: 'Yerevan', + languages: ['Armenian', 'Russian'], + population: 2994400, + flag: 'https://restcountries.eu/data/arm.svg', + currency: 'Armenian dram' + }, + { + name: 'Aruba', + capital: 'Oranjestad', + languages: ['Dutch', '(Eastern) Punjabi'], + population: 107394, + flag: 'https://restcountries.eu/data/abw.svg', + currency: 'Aruban florin' + }, + { + name: 'Australia', + capital: 'Canberra', + languages: ['English'], + population: 24117360, + flag: 'https://restcountries.eu/data/aus.svg', + currency: 'Australian dollar' + }, + { + name: 'Austria', + capital: 'Vienna', + languages: ['German'], + population: 8725931, + flag: 'https://restcountries.eu/data/aut.svg', + currency: 'Euro' + }, + { + name: 'Azerbaijan', + capital: 'Baku', + languages: ['Azerbaijani'], + population: 9730500, + flag: 'https://restcountries.eu/data/aze.svg', + currency: 'Azerbaijani manat' + }, + { + name: 'Bahamas', + capital: 'Nassau', + languages: ['English'], + population: 378040, + flag: 'https://restcountries.eu/data/bhs.svg', + currency: 'Bahamian dollar' + }, + { + name: 'Bahrain', + capital: 'Manama', + languages: ['Arabic'], + population: 1404900, + flag: 'https://restcountries.eu/data/bhr.svg', + currency: 'Bahraini dinar' + }, + { + name: 'Bangladesh', + capital: 'Dhaka', + languages: ['Bengali'], + population: 161006790, + flag: 'https://restcountries.eu/data/bgd.svg', + currency: 'Bangladeshi taka' + }, + { + name: 'Barbados', + capital: 'Bridgetown', + languages: ['English'], + population: 285000, + flag: 'https://restcountries.eu/data/brb.svg', + currency: 'Barbadian dollar' + }, + { + name: 'Belarus', + capital: 'Minsk', + languages: ['Belarusian', 'Russian'], + population: 9498700, + flag: 'https://restcountries.eu/data/blr.svg', + currency: 'New Belarusian ruble' + }, + { + name: 'Belgium', + capital: 'Brussels', + languages: ['Dutch', 'French', 'German'], + population: 11319511, + flag: 'https://restcountries.eu/data/bel.svg', + currency: 'Euro' + }, + { + name: 'Belize', + capital: 'Belmopan', + languages: ['English', 'Spanish'], + population: 370300, + flag: 'https://restcountries.eu/data/blz.svg', + currency: 'Belize dollar' + }, + { + name: 'Benin', + capital: 'Porto-Novo', + languages: ['French'], + population: 10653654, + flag: 'https://restcountries.eu/data/ben.svg', + currency: 'West African CFA franc' + }, + { + name: 'Bermuda', + capital: 'Hamilton', + languages: ['English'], + population: 61954, + flag: 'https://restcountries.eu/data/bmu.svg', + currency: 'Bermudian dollar' + }, + { + name: 'Bhutan', + capital: 'Thimphu', + languages: ['Dzongkha'], + population: 775620, + flag: 'https://restcountries.eu/data/btn.svg', + currency: 'Bhutanese ngultrum' + }, + { + name: 'Bolivia (Plurinational State of)', + capital: 'Sucre', + languages: ['Spanish', 'Aymara', 'Quechua'], + population: 10985059, + flag: 'https://restcountries.eu/data/bol.svg', + currency: 'Bolivian boliviano' + }, + { + name: 'Bonaire, Sint Eustatius and Saba', + capital: 'Kralendijk', + languages: ['Dutch'], + population: 17408, + flag: 'https://restcountries.eu/data/bes.svg', + currency: 'United States dollar' + }, + { + name: 'Bosnia and Herzegovina', + capital: 'Sarajevo', + languages: ['Bosnian', 'Croatian', 'Serbian'], + population: 3531159, + flag: 'https://restcountries.eu/data/bih.svg', + currency: 'Bosnia and Herzegovina convertible mark' + }, + { + name: 'Botswana', + capital: 'Gaborone', + languages: ['English', 'Tswana'], + population: 2141206, + flag: 'https://restcountries.eu/data/bwa.svg', + currency: 'Botswana pula' + }, + { + name: 'Bouvet Island', + capital: '', + languages: ['Norwegian', 'Norwegian Bokmål', 'Norwegian Nynorsk'], + population: 0, + flag: 'https://restcountries.eu/data/bvt.svg', + currency: 'Norwegian krone' + }, + { + name: 'Brazil', + capital: 'Brasília', + languages: ['Portuguese'], + population: 206135893, + flag: 'https://restcountries.eu/data/bra.svg', + currency: 'Brazilian real' + }, + { + name: 'British Indian Ocean Territory', + capital: 'Diego Garcia', + languages: ['English'], + population: 3000, + flag: 'https://restcountries.eu/data/iot.svg', + currency: 'United States dollar' + }, + { + name: 'United States Minor Outlying Islands', + capital: '', + languages: ['English'], + population: 300, + flag: 'https://restcountries.eu/data/umi.svg', + currency: 'United States Dollar' + }, + { + name: 'Virgin Islands (British)', + capital: 'Road Town', + languages: ['English'], + population: 28514, + flag: 'https://restcountries.eu/data/vgb.svg', + currency: '[D]' + }, + { + name: 'Virgin Islands (U.S.)', + capital: 'Charlotte Amalie', + languages: ['English'], + population: 114743, + flag: 'https://restcountries.eu/data/vir.svg', + currency: 'United States dollar' + }, + { + name: 'Brunei Darussalam', + capital: 'Bandar Seri Begawan', + languages: ['Malay'], + population: 411900, + flag: 'https://restcountries.eu/data/brn.svg', + currency: 'Brunei dollar' + }, + { + name: 'Bulgaria', + capital: 'Sofia', + languages: ['Bulgarian'], + population: 7153784, + flag: 'https://restcountries.eu/data/bgr.svg', + currency: 'Bulgarian lev' + }, + { + name: 'Burkina Faso', + capital: 'Ouagadougou', + languages: ['French', 'Fula'], + population: 19034397, + flag: 'https://restcountries.eu/data/bfa.svg', + currency: 'West African CFA franc' + }, + { + name: 'Burundi', + capital: 'Bujumbura', + languages: ['French', 'Kirundi'], + population: 10114505, + flag: 'https://restcountries.eu/data/bdi.svg', + currency: 'Burundian franc' + }, + { + name: 'Cambodia', + capital: 'Phnom Penh', + languages: ['Khmer'], + population: 15626444, + flag: 'https://restcountries.eu/data/khm.svg', + currency: 'Cambodian riel' + }, + { + name: 'Cameroon', + capital: 'Yaoundé', + languages: ['English', 'French'], + population: 22709892, + flag: 'https://restcountries.eu/data/cmr.svg', + currency: 'Central African CFA franc' + }, + { + name: 'Canada', + capital: 'Ottawa', + languages: ['English', 'French'], + population: 36155487, + flag: 'https://restcountries.eu/data/can.svg', + currency: 'Canadian dollar' + }, + { + name: 'Cabo Verde', + capital: 'Praia', + languages: ['Portuguese'], + population: 531239, + flag: 'https://restcountries.eu/data/cpv.svg', + currency: 'Cape Verdean escudo' + }, + { + name: 'Cayman Islands', + capital: 'George Town', + languages: ['English'], + population: 58238, + flag: 'https://restcountries.eu/data/cym.svg', + currency: 'Cayman Islands dollar' + }, + { + name: 'Central African Republic', + capital: 'Bangui', + languages: ['French', 'Sango'], + population: 4998000, + flag: 'https://restcountries.eu/data/caf.svg', + currency: 'Central African CFA franc' + }, + { + name: 'Chad', + capital: "N'Djamena", + languages: ['French', 'Arabic'], + population: 14497000, + flag: 'https://restcountries.eu/data/tcd.svg', + currency: 'Central African CFA franc' + }, + { + name: 'Chile', + capital: 'Santiago', + languages: ['Spanish'], + population: 18191900, + flag: 'https://restcountries.eu/data/chl.svg', + currency: 'Chilean peso' + }, + { + name: 'China', + capital: 'Beijing', + languages: ['Chinese'], + population: 1377422166, + flag: 'https://restcountries.eu/data/chn.svg', + currency: 'Chinese yuan' + }, + { + name: 'Christmas Island', + capital: 'Flying Fish Cove', + languages: ['English'], + population: 2072, + flag: 'https://restcountries.eu/data/cxr.svg', + currency: 'Australian dollar' + }, + { + name: 'Cocos (Keeling) Islands', + capital: 'West Island', + languages: ['English'], + population: 550, + flag: 'https://restcountries.eu/data/cck.svg', + currency: 'Australian dollar' + }, + { + name: 'Colombia', + capital: 'Bogotá', + languages: ['Spanish'], + population: 48759958, + flag: 'https://restcountries.eu/data/col.svg', + currency: 'Colombian peso' + }, + { + name: 'Comoros', + capital: 'Moroni', + languages: ['Arabic', 'French'], + population: 806153, + flag: 'https://restcountries.eu/data/com.svg', + currency: 'Comorian franc' + }, + { + name: 'Congo', + capital: 'Brazzaville', + languages: ['French', 'Lingala'], + population: 4741000, + flag: 'https://restcountries.eu/data/cog.svg', + currency: 'Central African CFA franc' + }, + { + name: 'Congo (Democratic Republic of the)', + capital: 'Kinshasa', + languages: ['French', 'Lingala', 'Kongo', 'Swahili', 'Luba-Katanga'], + population: 85026000, + flag: 'https://restcountries.eu/data/cod.svg', + currency: 'Congolese franc' + }, + { + name: 'Cook Islands', + capital: 'Avarua', + languages: ['English'], + population: 18100, + flag: 'https://restcountries.eu/data/cok.svg', + currency: 'New Zealand dollar' + }, + { + name: 'Costa Rica', + capital: 'San José', + languages: ['Spanish'], + population: 4890379, + flag: 'https://restcountries.eu/data/cri.svg', + currency: 'Costa Rican colón' + }, + { + name: 'Croatia', + capital: 'Zagreb', + languages: ['Croatian'], + population: 4190669, + flag: 'https://restcountries.eu/data/hrv.svg', + currency: 'Croatian kuna' + }, + { + name: 'Cuba', + capital: 'Havana', + languages: ['Spanish'], + population: 11239004, + flag: 'https://restcountries.eu/data/cub.svg', + currency: 'Cuban convertible peso' + }, + { + name: 'Curaçao', + capital: 'Willemstad', + languages: ['Dutch', '(Eastern) Punjabi', 'English'], + population: 154843, + flag: 'https://restcountries.eu/data/cuw.svg', + currency: 'Netherlands Antillean guilder' + }, + { + name: 'Cyprus', + capital: 'Nicosia', + languages: ['Greek (modern)', 'Turkish', 'Armenian'], + population: 847000, + flag: 'https://restcountries.eu/data/cyp.svg', + currency: 'Euro' + }, + { + name: 'Czech Republic', + capital: 'Prague', + languages: ['Czech', 'Slovak'], + population: 10558524, + flag: 'https://restcountries.eu/data/cze.svg', + currency: 'Czech koruna' + }, + { + name: 'Denmark', + capital: 'Copenhagen', + languages: ['Danish'], + population: 5717014, + flag: 'https://restcountries.eu/data/dnk.svg', + currency: 'Danish krone' + }, + { + name: 'Djibouti', + capital: 'Djibouti', + languages: ['French', 'Arabic'], + population: 900000, + flag: 'https://restcountries.eu/data/dji.svg', + currency: 'Djiboutian franc' + }, + { + name: 'Dominica', + capital: 'Roseau', + languages: ['English'], + population: 71293, + flag: 'https://restcountries.eu/data/dma.svg', + currency: 'East Caribbean dollar' + }, + { + name: 'Dominican Republic', + capital: 'Santo Domingo', + languages: ['Spanish'], + population: 10075045, + flag: 'https://restcountries.eu/data/dom.svg', + currency: 'Dominican peso' + }, + { + name: 'Ecuador', + capital: 'Quito', + languages: ['Spanish'], + population: 16545799, + flag: 'https://restcountries.eu/data/ecu.svg', + currency: 'United States dollar' + }, + { + name: 'Egypt', + capital: 'Cairo', + languages: ['Arabic'], + population: 91290000, + flag: 'https://restcountries.eu/data/egy.svg', + currency: 'Egyptian pound' + }, + { + name: 'El Salvador', + capital: 'San Salvador', + languages: ['Spanish'], + population: 6520675, + flag: 'https://restcountries.eu/data/slv.svg', + currency: 'United States dollar' + }, + { + name: 'Equatorial Guinea', + capital: 'Malabo', + languages: ['Spanish', 'French'], + population: 1222442, + flag: 'https://restcountries.eu/data/gnq.svg', + currency: 'Central African CFA franc' + }, + { + name: 'Eritrea', + capital: 'Asmara', + languages: ['Tigrinya', 'Arabic', 'English'], + population: 5352000, + flag: 'https://restcountries.eu/data/eri.svg', + currency: 'Eritrean nakfa' + }, + { + name: 'Estonia', + capital: 'Tallinn', + languages: ['Estonian'], + population: 1315944, + flag: 'https://restcountries.eu/data/est.svg', + currency: 'Euro' + }, + { + name: 'Ethiopia', + capital: 'Addis Ababa', + languages: ['Amharic'], + population: 92206005, + flag: 'https://restcountries.eu/data/eth.svg', + currency: 'Ethiopian birr' + }, + { + name: 'Falkland Islands (Malvinas)', + capital: 'Stanley', + languages: ['English'], + population: 2563, + flag: 'https://restcountries.eu/data/flk.svg', + currency: 'Falkland Islands pound' + }, + { + name: 'Faroe Islands', + capital: 'Tórshavn', + languages: ['Faroese'], + population: 49376, + flag: 'https://restcountries.eu/data/fro.svg', + currency: 'Danish krone' + }, + { + name: 'Fiji', + capital: 'Suva', + languages: ['English', 'Fijian', 'Hindi', 'Urdu'], + population: 867000, + flag: 'https://restcountries.eu/data/fji.svg', + currency: 'Fijian dollar' + }, + { + name: 'Finland', + capital: 'Helsinki', + languages: ['Finnish', 'Swedish'], + population: 5491817, + flag: 'https://restcountries.eu/data/fin.svg', + currency: 'Euro' + }, + { + name: 'France', + capital: 'Paris', + languages: ['French'], + population: 66710000, + flag: 'https://restcountries.eu/data/fra.svg', + currency: 'Euro' + }, + { + name: 'French Guiana', + capital: 'Cayenne', + languages: ['French'], + population: 254541, + flag: 'https://restcountries.eu/data/guf.svg', + currency: 'Euro' + }, + { + name: 'French Polynesia', + capital: 'Papeetē', + languages: ['French'], + population: 271800, + flag: 'https://restcountries.eu/data/pyf.svg', + currency: 'CFP franc' + }, + { + name: 'French Southern Territories', + capital: 'Port-aux-Français', + languages: ['French'], + population: 140, + flag: 'https://restcountries.eu/data/atf.svg', + currency: 'Euro' + }, + { + name: 'Gabon', + capital: 'Libreville', + languages: ['French'], + population: 1802278, + flag: 'https://restcountries.eu/data/gab.svg', + currency: 'Central African CFA franc' + }, + { + name: 'Gambia', + capital: 'Banjul', + languages: ['English'], + population: 1882450, + flag: 'https://restcountries.eu/data/gmb.svg', + currency: 'Gambian dalasi' + }, + { + name: 'Georgia', + capital: 'Tbilisi', + languages: ['Georgian'], + population: 3720400, + flag: 'https://restcountries.eu/data/geo.svg', + currency: 'Georgian Lari' + }, + { + name: 'Germany', + capital: 'Berlin', + languages: ['German'], + population: 81770900, + flag: 'https://restcountries.eu/data/deu.svg', + currency: 'Euro' + }, + { + name: 'Ghana', + capital: 'Accra', + languages: ['English'], + population: 27670174, + flag: 'https://restcountries.eu/data/gha.svg', + currency: 'Ghanaian cedi' + }, + { + name: 'Gibraltar', + capital: 'Gibraltar', + languages: ['English'], + population: 33140, + flag: 'https://restcountries.eu/data/gib.svg', + currency: 'Gibraltar pound' + }, + { + name: 'Greece', + capital: 'Athens', + languages: ['Greek (modern)'], + population: 10858018, + flag: 'https://restcountries.eu/data/grc.svg', + currency: 'Euro' + }, + { + name: 'Greenland', + capital: 'Nuuk', + languages: ['Kalaallisut'], + population: 55847, + flag: 'https://restcountries.eu/data/grl.svg', + currency: 'Danish krone' + }, + { + name: 'Grenada', + capital: "St. George's", + languages: ['English'], + population: 103328, + flag: 'https://restcountries.eu/data/grd.svg', + currency: 'East Caribbean dollar' + }, + { + name: 'Guadeloupe', + capital: 'Basse-Terre', + languages: ['French'], + population: 400132, + flag: 'https://restcountries.eu/data/glp.svg', + currency: 'Euro' + }, + { + name: 'Guam', + capital: 'Hagåtña', + languages: ['English', 'Chamorro', 'Spanish'], + population: 184200, + flag: 'https://restcountries.eu/data/gum.svg', + currency: 'United States dollar' + }, + { + name: 'Guatemala', + capital: 'Guatemala City', + languages: ['Spanish'], + population: 16176133, + flag: 'https://restcountries.eu/data/gtm.svg', + currency: 'Guatemalan quetzal' + }, + { + name: 'Guernsey', + capital: 'St. Peter Port', + languages: ['English', 'French'], + population: 62999, + flag: 'https://restcountries.eu/data/ggy.svg', + currency: 'British pound' + }, + { + name: 'Guinea', + capital: 'Conakry', + languages: ['French', 'Fula'], + population: 12947000, + flag: 'https://restcountries.eu/data/gin.svg', + currency: 'Guinean franc' + }, + { + name: 'Guinea-Bissau', + capital: 'Bissau', + languages: ['Portuguese'], + population: 1547777, + flag: 'https://restcountries.eu/data/gnb.svg', + currency: 'West African CFA franc' + }, + { + name: 'Guyana', + capital: 'Georgetown', + languages: ['English'], + population: 746900, + flag: 'https://restcountries.eu/data/guy.svg', + currency: 'Guyanese dollar' + }, + { + name: 'Haiti', + capital: 'Port-au-Prince', + languages: ['French', 'Haitian'], + population: 11078033, + flag: 'https://restcountries.eu/data/hti.svg', + currency: 'Haitian gourde' + }, + { + name: 'Heard Island and McDonald Islands', + capital: '', + languages: ['English'], + population: 0, + flag: 'https://restcountries.eu/data/hmd.svg', + currency: 'Australian dollar' + }, + { + name: 'Holy See', + capital: 'Rome', + languages: ['Latin', 'Italian', 'French', 'German'], + population: 451, + flag: 'https://restcountries.eu/data/vat.svg', + currency: 'Euro' + }, + { + name: 'Honduras', + capital: 'Tegucigalpa', + languages: ['Spanish'], + population: 8576532, + flag: 'https://restcountries.eu/data/hnd.svg', + currency: 'Honduran lempira' + }, + { + name: 'Hong Kong', + capital: 'City of Victoria', + languages: ['English', 'Chinese'], + population: 7324300, + flag: 'https://restcountries.eu/data/hkg.svg', + currency: 'Hong Kong dollar' + }, + { + name: 'Hungary', + capital: 'Budapest', + languages: ['Hungarian'], + population: 9823000, + flag: 'https://restcountries.eu/data/hun.svg', + currency: 'Hungarian forint' + }, + { + name: 'Iceland', + capital: 'Reykjavík', + languages: ['Icelandic'], + population: 334300, + flag: 'https://restcountries.eu/data/isl.svg', + currency: 'Icelandic króna' + }, + { + name: 'India', + capital: 'New Delhi', + languages: ['Hindi', 'English'], + population: 1295210000, + flag: 'https://restcountries.eu/data/ind.svg', + currency: 'Indian rupee' + }, + { + name: 'Indonesia', + capital: 'Jakarta', + languages: ['Indonesian'], + population: 258705000, + flag: 'https://restcountries.eu/data/idn.svg', + currency: 'Indonesian rupiah' + }, + { + name: "Côte d'Ivoire", + capital: 'Yamoussoukro', + languages: ['French'], + population: 22671331, + flag: 'https://restcountries.eu/data/civ.svg', + currency: 'West African CFA franc' + }, + { + name: 'Iran (Islamic Republic of)', + capital: 'Tehran', + languages: ['Persian (Farsi)'], + population: 79369900, + flag: 'https://restcountries.eu/data/irn.svg', + currency: 'Iranian rial' + }, + { + name: 'Iraq', + capital: 'Baghdad', + languages: ['Arabic', 'Kurdish'], + population: 37883543, + flag: 'https://restcountries.eu/data/irq.svg', + currency: 'Iraqi dinar' + }, + { + name: 'Ireland', + capital: 'Dublin', + languages: ['Irish', 'English'], + population: 6378000, + flag: 'https://restcountries.eu/data/irl.svg', + currency: 'Euro' + }, + { + name: 'Isle of Man', + capital: 'Douglas', + languages: ['English', 'Manx'], + population: 84497, + flag: 'https://restcountries.eu/data/imn.svg', + currency: 'British pound' + }, + { + name: 'Israel', + capital: 'Jerusalem', + languages: ['Hebrew (modern)', 'Arabic'], + population: 8527400, + flag: 'https://restcountries.eu/data/isr.svg', + currency: 'Israeli new shekel' + }, + { + name: 'Italy', + capital: 'Rome', + languages: ['Italian'], + population: 60665551, + flag: 'https://restcountries.eu/data/ita.svg', + currency: 'Euro' + }, + { + name: 'Jamaica', + capital: 'Kingston', + languages: ['English'], + population: 2723246, + flag: 'https://restcountries.eu/data/jam.svg', + currency: 'Jamaican dollar' + }, + { + name: 'Japan', + capital: 'Tokyo', + languages: ['Japanese'], + population: 126960000, + flag: 'https://restcountries.eu/data/jpn.svg', + currency: 'Japanese yen' + }, + { + name: 'Jersey', + capital: 'Saint Helier', + languages: ['English', 'French'], + population: 100800, + flag: 'https://restcountries.eu/data/jey.svg', + currency: 'British pound' + }, + { + name: 'Jordan', + capital: 'Amman', + languages: ['Arabic'], + population: 9531712, + flag: 'https://restcountries.eu/data/jor.svg', + currency: 'Jordanian dinar' + }, + { + name: 'Kazakhstan', + capital: 'Astana', + languages: ['Kazakh', 'Russian'], + population: 17753200, + flag: 'https://restcountries.eu/data/kaz.svg', + currency: 'Kazakhstani tenge' + }, + { + name: 'Kenya', + capital: 'Nairobi', + languages: ['English', 'Swahili'], + population: 47251000, + flag: 'https://restcountries.eu/data/ken.svg', + currency: 'Kenyan shilling' + }, + { + name: 'Kiribati', + capital: 'South Tarawa', + languages: ['English'], + population: 113400, + flag: 'https://restcountries.eu/data/kir.svg', + currency: 'Australian dollar' + }, + { + name: 'Kuwait', + capital: 'Kuwait City', + languages: ['Arabic'], + population: 4183658, + flag: 'https://restcountries.eu/data/kwt.svg', + currency: 'Kuwaiti dinar' + }, + { + name: 'Kyrgyzstan', + capital: 'Bishkek', + languages: ['Kyrgyz', 'Russian'], + population: 6047800, + flag: 'https://restcountries.eu/data/kgz.svg', + currency: 'Kyrgyzstani som' + }, + { + name: "Lao People's Democratic Republic", + capital: 'Vientiane', + languages: ['Lao'], + population: 6492400, + flag: 'https://restcountries.eu/data/lao.svg', + currency: 'Lao kip' + }, + { + name: 'Latvia', + capital: 'Riga', + languages: ['Latvian'], + population: 1961600, + flag: 'https://restcountries.eu/data/lva.svg', + currency: 'Euro' + }, + { + name: 'Lebanon', + capital: 'Beirut', + languages: ['Arabic', 'French'], + population: 5988000, + flag: 'https://restcountries.eu/data/lbn.svg', + currency: 'Lebanese pound' + }, + { + name: 'Lesotho', + capital: 'Maseru', + languages: ['English', 'Southern Sotho'], + population: 1894194, + flag: 'https://restcountries.eu/data/lso.svg', + currency: 'Lesotho loti' + }, + { + name: 'Liberia', + capital: 'Monrovia', + languages: ['English'], + population: 4615000, + flag: 'https://restcountries.eu/data/lbr.svg', + currency: 'Liberian dollar' + }, + { + name: 'Libya', + capital: 'Tripoli', + languages: ['Arabic'], + population: 6385000, + flag: 'https://restcountries.eu/data/lby.svg', + currency: 'Libyan dinar' + }, + { + name: 'Liechtenstein', + capital: 'Vaduz', + languages: ['German'], + population: 37623, + flag: 'https://restcountries.eu/data/lie.svg', + currency: 'Swiss franc' + }, + { + name: 'Lithuania', + capital: 'Vilnius', + languages: ['Lithuanian'], + population: 2872294, + flag: 'https://restcountries.eu/data/ltu.svg', + currency: 'Euro' + }, + { + name: 'Luxembourg', + capital: 'Luxembourg', + languages: ['French', 'German', 'Luxembourgish'], + population: 576200, + flag: 'https://restcountries.eu/data/lux.svg', + currency: 'Euro' + }, + { + name: 'Macao', + capital: '', + languages: ['Chinese', 'Portuguese'], + population: 649100, + flag: 'https://restcountries.eu/data/mac.svg', + currency: 'Macanese pataca' + }, + { + name: 'Macedonia (the former Yugoslav Republic of)', + capital: 'Skopje', + languages: ['Macedonian'], + population: 2058539, + flag: 'https://restcountries.eu/data/mkd.svg', + currency: 'Macedonian denar' + }, + { + name: 'Madagascar', + capital: 'Antananarivo', + languages: ['French', 'Malagasy'], + population: 22434363, + flag: 'https://restcountries.eu/data/mdg.svg', + currency: 'Malagasy ariary' + }, + { + name: 'Malawi', + capital: 'Lilongwe', + languages: ['English', 'Chichewa'], + population: 16832910, + flag: 'https://restcountries.eu/data/mwi.svg', + currency: 'Malawian kwacha' + }, + { + name: 'Malaysia', + capital: 'Kuala Lumpur', + languages: ['Malaysian'], + population: 31405416, + flag: 'https://restcountries.eu/data/mys.svg', + currency: 'Malaysian ringgit' + }, + { + name: 'Maldives', + capital: 'Malé', + languages: ['Divehi'], + population: 344023, + flag: 'https://restcountries.eu/data/mdv.svg', + currency: 'Maldivian rufiyaa' + }, + { + name: 'Mali', + capital: 'Bamako', + languages: ['French'], + population: 18135000, + flag: 'https://restcountries.eu/data/mli.svg', + currency: 'West African CFA franc' + }, + { + name: 'Malta', + capital: 'Valletta', + languages: ['Maltese', 'English'], + population: 425384, + flag: 'https://restcountries.eu/data/mlt.svg', + currency: 'Euro' + }, + { + name: 'Marshall Islands', + capital: 'Majuro', + languages: ['English', 'Marshallese'], + population: 54880, + flag: 'https://restcountries.eu/data/mhl.svg', + currency: 'United States dollar' + }, + { + name: 'Martinique', + capital: 'Fort-de-France', + languages: ['French'], + population: 378243, + flag: 'https://restcountries.eu/data/mtq.svg', + currency: 'Euro' + }, + { + name: 'Mauritania', + capital: 'Nouakchott', + languages: ['Arabic'], + population: 3718678, + flag: 'https://restcountries.eu/data/mrt.svg', + currency: 'Mauritanian ouguiya' + }, + { + name: 'Mauritius', + capital: 'Port Louis', + languages: ['English'], + population: 1262879, + flag: 'https://restcountries.eu/data/mus.svg', + currency: 'Mauritian rupee' + }, + { + name: 'Mayotte', + capital: 'Mamoudzou', + languages: ['French'], + population: 226915, + flag: 'https://restcountries.eu/data/myt.svg', + currency: 'Euro' + }, + { + name: 'Mexico', + capital: 'Mexico City', + languages: ['Spanish'], + population: 122273473, + flag: 'https://restcountries.eu/data/mex.svg', + currency: 'Mexican peso' + }, + { + name: 'Micronesia (Federated States of)', + capital: 'Palikir', + languages: ['English'], + population: 102800, + flag: 'https://restcountries.eu/data/fsm.svg', + currency: '[D]' + }, + { + name: 'Moldova (Republic of)', + capital: 'Chișinău', + languages: ['Romanian'], + population: 3553100, + flag: 'https://restcountries.eu/data/mda.svg', + currency: 'Moldovan leu' + }, + { + name: 'Monaco', + capital: 'Monaco', + languages: ['French'], + population: 38400, + flag: 'https://restcountries.eu/data/mco.svg', + currency: 'Euro' + }, + { + name: 'Mongolia', + capital: 'Ulan Bator', + languages: ['Mongolian'], + population: 3093100, + flag: 'https://restcountries.eu/data/mng.svg', + currency: 'Mongolian tögrög' + }, + { + name: 'Montenegro', + capital: 'Podgorica', + languages: ['Serbian', 'Bosnian', 'Albanian', 'Croatian'], + population: 621810, + flag: 'https://restcountries.eu/data/mne.svg', + currency: 'Euro' + }, + { + name: 'Montserrat', + capital: 'Plymouth', + languages: ['English'], + population: 4922, + flag: 'https://restcountries.eu/data/msr.svg', + currency: 'East Caribbean dollar' + }, + { + name: 'Morocco', + capital: 'Rabat', + languages: ['Arabic'], + population: 33337529, + flag: 'https://restcountries.eu/data/mar.svg', + currency: 'Moroccan dirham' + }, + { + name: 'Mozambique', + capital: 'Maputo', + languages: ['Portuguese'], + population: 26423700, + flag: 'https://restcountries.eu/data/moz.svg', + currency: 'Mozambican metical' + }, + { + name: 'Myanmar', + capital: 'Naypyidaw', + languages: ['Burmese'], + population: 51419420, + flag: 'https://restcountries.eu/data/mmr.svg', + currency: 'Burmese kyat' + }, + { + name: 'Namibia', + capital: 'Windhoek', + languages: ['English', 'Afrikaans'], + population: 2324388, + flag: 'https://restcountries.eu/data/nam.svg', + currency: 'Namibian dollar' + }, + { + name: 'Nauru', + capital: 'Yaren', + languages: ['English', 'Nauruan'], + population: 10084, + flag: 'https://restcountries.eu/data/nru.svg', + currency: 'Australian dollar' + }, + { + name: 'Nepal', + capital: 'Kathmandu', + languages: ['Nepali'], + population: 28431500, + flag: 'https://restcountries.eu/data/npl.svg', + currency: 'Nepalese rupee' + }, + { + name: 'Netherlands', + capital: 'Amsterdam', + languages: ['Dutch'], + population: 17019800, + flag: 'https://restcountries.eu/data/nld.svg', + currency: 'Euro' + }, + { + name: 'New Caledonia', + capital: 'Nouméa', + languages: ['French'], + population: 268767, + flag: 'https://restcountries.eu/data/ncl.svg', + currency: 'CFP franc' + }, + { + name: 'New Zealand', + capital: 'Wellington', + languages: ['English', 'Māori'], + population: 4697854, + flag: 'https://restcountries.eu/data/nzl.svg', + currency: 'New Zealand dollar' + }, + { + name: 'Nicaragua', + capital: 'Managua', + languages: ['Spanish'], + population: 6262703, + flag: 'https://restcountries.eu/data/nic.svg', + currency: 'Nicaraguan córdoba' + }, + { + name: 'Niger', + capital: 'Niamey', + languages: ['French'], + population: 20715000, + flag: 'https://restcountries.eu/data/ner.svg', + currency: 'West African CFA franc' + }, + { + name: 'Nigeria', + capital: 'Abuja', + languages: ['English'], + population: 186988000, + flag: 'https://restcountries.eu/data/nga.svg', + currency: 'Nigerian naira' + }, + { + name: 'Niue', + capital: 'Alofi', + languages: ['English'], + population: 1470, + flag: 'https://restcountries.eu/data/niu.svg', + currency: 'New Zealand dollar' + }, + { + name: 'Norfolk Island', + capital: 'Kingston', + languages: ['English'], + population: 2302, + flag: 'https://restcountries.eu/data/nfk.svg', + currency: 'Australian dollar' + }, + { + name: "Korea (Democratic People's Republic of)", + capital: 'Pyongyang', + languages: ['Korean'], + population: 25281000, + flag: 'https://restcountries.eu/data/prk.svg', + currency: 'North Korean won' + }, + { + name: 'Northern Mariana Islands', + capital: 'Saipan', + languages: ['English', 'Chamorro'], + population: 56940, + flag: 'https://restcountries.eu/data/mnp.svg', + currency: 'United States dollar' + }, + { + name: 'Norway', + capital: 'Oslo', + languages: ['Norwegian', 'Norwegian Bokmål', 'Norwegian Nynorsk'], + population: 5223256, + flag: 'https://restcountries.eu/data/nor.svg', + currency: 'Norwegian krone' + }, + { + name: 'Oman', + capital: 'Muscat', + languages: ['Arabic'], + population: 4420133, + flag: 'https://restcountries.eu/data/omn.svg', + currency: 'Omani rial' + }, + { + name: 'Pakistan', + capital: 'Islamabad', + languages: ['English', 'Urdu'], + population: 194125062, + flag: 'https://restcountries.eu/data/pak.svg', + currency: 'Pakistani rupee' + }, + { + name: 'Palau', + capital: 'Ngerulmud', + languages: ['English'], + population: 17950, + flag: 'https://restcountries.eu/data/plw.svg', + currency: '[E]' + }, + { + name: 'Palestine, State of', + capital: 'Ramallah', + languages: ['Arabic'], + population: 4682467, + flag: 'https://restcountries.eu/data/pse.svg', + currency: 'Israeli new sheqel' + }, + { + name: 'Panama', + capital: 'Panama City', + languages: ['Spanish'], + population: 3814672, + flag: 'https://restcountries.eu/data/pan.svg', + currency: 'Panamanian balboa' + }, + { + name: 'Papua New Guinea', + capital: 'Port Moresby', + languages: ['English'], + population: 8083700, + flag: 'https://restcountries.eu/data/png.svg', + currency: 'Papua New Guinean kina' + }, + { + name: 'Paraguay', + capital: 'Asunción', + languages: ['Spanish', 'Guaraní'], + population: 6854536, + flag: 'https://restcountries.eu/data/pry.svg', + currency: 'Paraguayan guaraní' + }, + { + name: 'Peru', + capital: 'Lima', + languages: ['Spanish'], + population: 31488700, + flag: 'https://restcountries.eu/data/per.svg', + currency: 'Peruvian sol' + }, + { + name: 'Philippines', + capital: 'Manila', + languages: ['English'], + population: 103279800, + flag: 'https://restcountries.eu/data/phl.svg', + currency: 'Philippine peso' + }, + { + name: 'Pitcairn', + capital: 'Adamstown', + languages: ['English'], + population: 56, + flag: 'https://restcountries.eu/data/pcn.svg', + currency: 'New Zealand dollar' + }, + { + name: 'Poland', + capital: 'Warsaw', + languages: ['Polish'], + population: 38437239, + flag: 'https://restcountries.eu/data/pol.svg', + currency: 'Polish złoty' + }, + { + name: 'Portugal', + capital: 'Lisbon', + languages: ['Portuguese'], + population: 10374822, + flag: 'https://restcountries.eu/data/prt.svg', + currency: 'Euro' + }, + { + name: 'Puerto Rico', + capital: 'San Juan', + languages: ['Spanish', 'English'], + population: 3474182, + flag: 'https://restcountries.eu/data/pri.svg', + currency: 'United States dollar' + }, + { + name: 'Qatar', + capital: 'Doha', + languages: ['Arabic'], + population: 2587564, + flag: 'https://restcountries.eu/data/qat.svg', + currency: 'Qatari riyal' + }, + { + name: 'Republic of Kosovo', + capital: 'Pristina', + languages: ['Albanian', 'Serbian'], + population: 1733842, + flag: 'https://restcountries.eu/data/kos.svg', + currency: 'Euro' + }, + { + name: 'Réunion', + capital: 'Saint-Denis', + languages: ['French'], + population: 840974, + flag: 'https://restcountries.eu/data/reu.svg', + currency: 'Euro' + }, + { + name: 'Romania', + capital: 'Bucharest', + languages: ['Romanian'], + population: 19861408, + flag: 'https://restcountries.eu/data/rou.svg', + currency: 'Romanian leu' + }, + { + name: 'Russian Federation', + capital: 'Moscow', + languages: ['Russian'], + population: 146599183, + flag: 'https://restcountries.eu/data/rus.svg', + currency: 'Russian ruble' + }, + { + name: 'Rwanda', + capital: 'Kigali', + languages: ['Kinyarwanda', 'English', 'French'], + population: 11553188, + flag: 'https://restcountries.eu/data/rwa.svg', + currency: 'Rwandan franc' + }, + { + name: 'Saint Barthélemy', + capital: 'Gustavia', + languages: ['French'], + population: 9417, + flag: 'https://restcountries.eu/data/blm.svg', + currency: 'Euro' + }, + { + name: 'Saint Helena, Ascension and Tristan da Cunha', + capital: 'Jamestown', + languages: ['English'], + population: 4255, + flag: 'https://restcountries.eu/data/shn.svg', + currency: 'Saint Helena pound' + }, + { + name: 'Saint Kitts and Nevis', + capital: 'Basseterre', + languages: ['English'], + population: 46204, + flag: 'https://restcountries.eu/data/kna.svg', + currency: 'East Caribbean dollar' + }, + { + name: 'Saint Lucia', + capital: 'Castries', + languages: ['English'], + population: 186000, + flag: 'https://restcountries.eu/data/lca.svg', + currency: 'East Caribbean dollar' + }, + { + name: 'Saint Martin (French part)', + capital: 'Marigot', + languages: ['English', 'French', 'Dutch'], + population: 36979, + flag: 'https://restcountries.eu/data/maf.svg', + currency: 'Euro' + }, + { + name: 'Saint Pierre and Miquelon', + capital: 'Saint-Pierre', + languages: ['French'], + population: 6069, + flag: 'https://restcountries.eu/data/spm.svg', + currency: 'Euro' + }, + { + name: 'Saint Vincent and the Grenadines', + capital: 'Kingstown', + languages: ['English'], + population: 109991, + flag: 'https://restcountries.eu/data/vct.svg', + currency: 'East Caribbean dollar' + }, + { + name: 'Samoa', + capital: 'Apia', + languages: ['Samoan', 'English'], + population: 194899, + flag: 'https://restcountries.eu/data/wsm.svg', + currency: 'Samoan tālā' + }, + { + name: 'San Marino', + capital: 'City of San Marino', + languages: ['Italian'], + population: 33005, + flag: 'https://restcountries.eu/data/smr.svg', + currency: 'Euro' + }, + { + name: 'Sao Tome and Principe', + capital: 'São Tomé', + languages: ['Portuguese'], + population: 187356, + flag: 'https://restcountries.eu/data/stp.svg', + currency: 'São Tomé and Príncipe dobra' + }, + { + name: 'Saudi Arabia', + capital: 'Riyadh', + languages: ['Arabic'], + population: 32248200, + flag: 'https://restcountries.eu/data/sau.svg', + currency: 'Saudi riyal' + }, + { + name: 'Senegal', + capital: 'Dakar', + languages: ['French'], + population: 14799859, + flag: 'https://restcountries.eu/data/sen.svg', + currency: 'West African CFA franc' + }, + { + name: 'Serbia', + capital: 'Belgrade', + languages: ['Serbian'], + population: 7076372, + flag: 'https://restcountries.eu/data/srb.svg', + currency: 'Serbian dinar' + }, + { + name: 'Seychelles', + capital: 'Victoria', + languages: ['French', 'English'], + population: 91400, + flag: 'https://restcountries.eu/data/syc.svg', + currency: 'Seychellois rupee' + }, + { + name: 'Sierra Leone', + capital: 'Freetown', + languages: ['English'], + population: 7075641, + flag: 'https://restcountries.eu/data/sle.svg', + currency: 'Sierra Leonean leone' + }, + { + name: 'Singapore', + capital: 'Singapore', + languages: ['English', 'Malay', 'Tamil', 'Chinese'], + population: 5535000, + flag: 'https://restcountries.eu/data/sgp.svg', + currency: 'Brunei dollar' + }, + { + name: 'Sint Maarten (Dutch part)', + capital: 'Philipsburg', + languages: ['Dutch', 'English'], + population: 38247, + flag: 'https://restcountries.eu/data/sxm.svg', + currency: 'Netherlands Antillean guilder' + }, + { + name: 'Slovakia', + capital: 'Bratislava', + languages: ['Slovak'], + population: 5426252, + flag: 'https://restcountries.eu/data/svk.svg', + currency: 'Euro' + }, + { + name: 'Slovenia', + capital: 'Ljubljana', + languages: ['Slovene'], + population: 2064188, + flag: 'https://restcountries.eu/data/svn.svg', + currency: 'Euro' + }, + { + name: 'Solomon Islands', + capital: 'Honiara', + languages: ['English'], + population: 642000, + flag: 'https://restcountries.eu/data/slb.svg', + currency: 'Solomon Islands dollar' + }, + { + name: 'Somalia', + capital: 'Mogadishu', + languages: ['Somali', 'Arabic'], + population: 11079000, + flag: 'https://restcountries.eu/data/som.svg', + currency: 'Somali shilling' + }, + { + name: 'South Africa', + capital: 'Pretoria', + languages: [ + 'Afrikaans', + 'English', + 'Southern Ndebele', + 'Southern Sotho', + 'Swati', + 'Tswana', + 'Tsonga', + 'Venda', + 'Xhosa', + 'Zulu' + ], + population: 55653654, + flag: 'https://restcountries.eu/data/zaf.svg', + currency: 'South African rand' + }, + { + name: 'South Georgia and the South Sandwich Islands', + capital: 'King Edward Point', + languages: ['English'], + population: 30, + flag: 'https://restcountries.eu/data/sgs.svg', + currency: 'British pound' + }, + { + name: 'Korea (Republic of)', + capital: 'Seoul', + languages: ['Korean'], + population: 50801405, + flag: 'https://restcountries.eu/data/kor.svg', + currency: 'South Korean won' + }, + { + name: 'South Sudan', + capital: 'Juba', + languages: ['English'], + population: 12131000, + flag: 'https://restcountries.eu/data/ssd.svg', + currency: 'South Sudanese pound' + }, + { + name: 'Spain', + capital: 'Madrid', + languages: ['Spanish'], + population: 46438422, + flag: 'https://restcountries.eu/data/esp.svg', + currency: 'Euro' + }, + { + name: 'Sri Lanka', + capital: 'Colombo', + languages: ['Sinhalese', 'Tamil'], + population: 20966000, + flag: 'https://restcountries.eu/data/lka.svg', + currency: 'Sri Lankan rupee' + }, + { + name: 'Sudan', + capital: 'Khartoum', + languages: ['Arabic', 'English'], + population: 39598700, + flag: 'https://restcountries.eu/data/sdn.svg', + currency: 'Sudanese pound' + }, + { + name: 'Suriname', + capital: 'Paramaribo', + languages: ['Dutch'], + population: 541638, + flag: 'https://restcountries.eu/data/sur.svg', + currency: 'Surinamese dollar' + }, + { + name: 'Svalbard and Jan Mayen', + capital: 'Longyearbyen', + languages: ['Norwegian'], + population: 2562, + flag: 'https://restcountries.eu/data/sjm.svg', + currency: 'Norwegian krone' + }, + { + name: 'Swaziland', + capital: 'Lobamba', + languages: ['English', 'Swati'], + population: 1132657, + flag: 'https://restcountries.eu/data/swz.svg', + currency: 'Swazi lilangeni' + }, + { + name: 'Sweden', + capital: 'Stockholm', + languages: ['Swedish'], + population: 9894888, + flag: 'https://restcountries.eu/data/swe.svg', + currency: 'Swedish krona' + }, + { + name: 'Switzerland', + capital: 'Bern', + languages: ['German', 'French', 'Italian'], + population: 8341600, + flag: 'https://restcountries.eu/data/che.svg', + currency: 'Swiss franc' + }, + { + name: 'Syrian Arab Republic', + capital: 'Damascus', + languages: ['Arabic'], + population: 18564000, + flag: 'https://restcountries.eu/data/syr.svg', + currency: 'Syrian pound' + }, + { + name: 'Taiwan', + capital: 'Taipei', + languages: ['Chinese'], + population: 23503349, + flag: 'https://restcountries.eu/data/twn.svg', + currency: 'New Taiwan dollar' + }, + { + name: 'Tajikistan', + capital: 'Dushanbe', + languages: ['Tajik', 'Russian'], + population: 8593600, + flag: 'https://restcountries.eu/data/tjk.svg', + currency: 'Tajikistani somoni' + }, + { + name: 'Tanzania, United Republic of', + capital: 'Dodoma', + languages: ['Swahili', 'English'], + population: 55155000, + flag: 'https://restcountries.eu/data/tza.svg', + currency: 'Tanzanian shilling' + }, + { + name: 'Thailand', + capital: 'Bangkok', + languages: ['Thai'], + population: 65327652, + flag: 'https://restcountries.eu/data/tha.svg', + currency: 'Thai baht' + }, + { + name: 'Timor-Leste', + capital: 'Dili', + languages: ['Portuguese'], + population: 1167242, + flag: 'https://restcountries.eu/data/tls.svg', + currency: 'United States dollar' + }, + { + name: 'Togo', + capital: 'Lomé', + languages: ['French'], + population: 7143000, + flag: 'https://restcountries.eu/data/tgo.svg', + currency: 'West African CFA franc' + }, + { + name: 'Tokelau', + capital: 'Fakaofo', + languages: ['English'], + population: 1411, + flag: 'https://restcountries.eu/data/tkl.svg', + currency: 'New Zealand dollar' + }, + { + name: 'Tonga', + capital: "Nuku'alofa", + languages: ['English', 'Tonga (Tonga Islands)'], + population: 103252, + flag: 'https://restcountries.eu/data/ton.svg', + currency: 'Tongan paʻanga' + }, + { + name: 'Trinidad and Tobago', + capital: 'Port of Spain', + languages: ['English'], + population: 1349667, + flag: 'https://restcountries.eu/data/tto.svg', + currency: 'Trinidad and Tobago dollar' + }, + { + name: 'Tunisia', + capital: 'Tunis', + languages: ['Arabic'], + population: 11154400, + flag: 'https://restcountries.eu/data/tun.svg', + currency: 'Tunisian dinar' + }, + { + name: 'Turkey', + capital: 'Ankara', + languages: ['Turkish'], + population: 78741053, + flag: 'https://restcountries.eu/data/tur.svg', + currency: 'Turkish lira' + }, + { + name: 'Turkmenistan', + capital: 'Ashgabat', + languages: ['Turkmen', 'Russian'], + population: 4751120, + flag: 'https://restcountries.eu/data/tkm.svg', + currency: 'Turkmenistan manat' + }, + { + name: 'Turks and Caicos Islands', + capital: 'Cockburn Town', + languages: ['English'], + population: 31458, + flag: 'https://restcountries.eu/data/tca.svg', + currency: 'United States dollar' + }, + { + name: 'Tuvalu', + capital: 'Funafuti', + languages: ['English'], + population: 10640, + flag: 'https://restcountries.eu/data/tuv.svg', + currency: 'Australian dollar' + }, + { + name: 'Uganda', + capital: 'Kampala', + languages: ['English', 'Swahili'], + population: 33860700, + flag: 'https://restcountries.eu/data/uga.svg', + currency: 'Ugandan shilling' + }, + { + name: 'Ukraine', + capital: 'Kiev', + languages: ['Ukrainian'], + population: 42692393, + flag: 'https://restcountries.eu/data/ukr.svg', + currency: 'Ukrainian hryvnia' + }, + { + name: 'United Arab Emirates', + capital: 'Abu Dhabi', + languages: ['Arabic'], + population: 9856000, + flag: 'https://restcountries.eu/data/are.svg', + currency: 'United Arab Emirates dirham' + }, + { + name: 'United Kingdom of Great Britain and Northern Ireland', + capital: 'London', + languages: ['English'], + population: 65110000, + flag: 'https://restcountries.eu/data/gbr.svg', + currency: 'British pound' + }, + { + name: 'United States of America', + capital: 'Washington, D.C.', + languages: ['English'], + population: 323947000, + flag: 'https://restcountries.eu/data/usa.svg', + currency: 'United States dollar' + }, + { + name: 'Uruguay', + capital: 'Montevideo', + languages: ['Spanish'], + population: 3480222, + flag: 'https://restcountries.eu/data/ury.svg', + currency: 'Uruguayan peso' + }, + { + name: 'Uzbekistan', + capital: 'Tashkent', + languages: ['Uzbek', 'Russian'], + population: 31576400, + flag: 'https://restcountries.eu/data/uzb.svg', + currency: "Uzbekistani so'm" + }, + { + name: 'Vanuatu', + capital: 'Port Vila', + languages: ['Bislama', 'English', 'French'], + population: 277500, + flag: 'https://restcountries.eu/data/vut.svg', + currency: 'Vanuatu vatu' + }, + { + name: 'Venezuela (Bolivarian Republic of)', + capital: 'Caracas', + languages: ['Spanish'], + population: 31028700, + flag: 'https://restcountries.eu/data/ven.svg', + currency: 'Venezuelan bolívar' + }, + { + name: 'Viet Nam', + capital: 'Hanoi', + languages: ['Vietnamese'], + population: 92700000, + flag: 'https://restcountries.eu/data/vnm.svg', + currency: 'Vietnamese đồng' + }, + { + name: 'Wallis and Futuna', + capital: 'Mata-Utu', + languages: ['French'], + population: 11750, + flag: 'https://restcountries.eu/data/wlf.svg', + currency: 'CFP franc' + }, + { + name: 'Western Sahara', + capital: 'El Aaiún', + languages: ['Spanish'], + population: 510713, + flag: 'https://restcountries.eu/data/esh.svg', + currency: 'Moroccan dirham' + }, + { + name: 'Yemen', + capital: "Sana'a", + languages: ['Arabic'], + population: 27478000, + flag: 'https://restcountries.eu/data/yem.svg', + currency: 'Yemeni rial' + }, + { + name: 'Zambia', + capital: 'Lusaka', + languages: ['English'], + population: 15933883, + flag: 'https://restcountries.eu/data/zmb.svg', + currency: 'Zambian kwacha' + }, + { + name: 'Zimbabwe', + capital: 'Harare', + languages: ['English', 'Shona', 'Northern Ndebele'], + population: 14240168, + flag: 'https://restcountries.eu/data/zwe.svg', + currency: 'Botswana pula' + } +] diff --git a/08_Day/08_day_starter/index.html b/08_Day/08_day_starter/index.html new file mode 100644 index 00000000..c677e950 --- /dev/null +++ b/08_Day/08_day_starter/index.html @@ -0,0 +1,17 @@ + + + + + 30DaysOfJavaScript:08 Day + + + +

30DaysOfJavaScript:08 Day

+

Objects

+ + + + + + + \ No newline at end of file diff --git a/08_Day/08_day_starter/scripts/main.js b/08_Day/08_day_starter/scripts/main.js new file mode 100644 index 00000000..c6045c83 --- /dev/null +++ b/08_Day/08_day_starter/scripts/main.js @@ -0,0 +1,2 @@ +console.log(countries) +alert('Open the console and check if the countries has been loaded') \ No newline at end of file