├── week2
├── months.js
├── scripts.js
└── variables.js
├── week3
├── index.html
├── logical-operators.js
├── functions.js
├── loops.js
├── arrays.js
└── conditionals.js
├── week8
├── index.html
├── regex.html
├── functions.html
├── hoisting.html
├── hoisting.js
├── functions.js
├── fetch.js
├── promise.js
├── async-await.js
├── fetch.html
├── async-await.html
└── regex.js
├── week5
├── dom-1.js
├── dom-number.js
├── dom.js
├── dom-raondom-hexa.js
├── dom.html
├── revision-objects.js
├── functional-programming.js
└── further-on-loops.js
├── week7
├── oop-1.js
├── oop-2-setting-getter.js
├── world-countries-data.html
├── oop-inheritance.js
├── countries-object-dom.js
└── index.html
├── week6
├── revision-HOF.js
├── countries-object-dom.js
├── dom-two-input-fields.html
├── dom-getting_revision.html
├── single-input-field.html
├── change-background-color.html
├── countries-object-dom-backup.js
├── world-countries-data.html
└── dom-creating-revision.html
├── index.html
├── notes.md
├── graph.html
├── readme.md
├── data
├── countries-array.js
└── countries-object.js
└── week4
└── revision-condition-function-loops.js
/week2/months.js:
--------------------------------------------------------------------------------
1 | const months = ['January','February','March','April','May','June','July','August','September','October','November','December','January']
--------------------------------------------------------------------------------
/week2/scripts.js:
--------------------------------------------------------------------------------
1 | console.log('I am happy to teach JS.')
2 | console.log("This double quote, and it will work")
3 | console.log('This is a single quote')
4 | console.log('hI')
5 |
6 |
7 | // writing a single line comment
8 |
9 |
10 | /*
11 | our comment goes on
12 | multiple
13 | lines
14 |
15 | */
--------------------------------------------------------------------------------
/week3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/week8/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/week8/regex.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/week8/functions.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/week8/hoisting.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/week5/dom-1.js:
--------------------------------------------------------------------------------
1 | // DOM => Document Object Model
2 | // getting the DOM, CREATING, ADDING ATTRIBUTE
3 |
4 | const title = document.getElementById('title')
5 | console.log(title)
6 | title.textContent = 'Daddda'
7 | title.style.color = 'green'
8 |
9 | const paragraphs = document.getElementsByClassName('web')
10 | console.log(paragraphs)
11 | // regurlar for loop
12 | for(const p of paragraphs){
13 | p.style.color = 'red'
14 | }
15 |
16 | // getElementById, //getElementsByTagName, getElementsByClassName
17 |
--------------------------------------------------------------------------------
/week3/logical-operators.js:
--------------------------------------------------------------------------------
1 | // &&, ||, !
2 |
3 | console.log('We are learning logical operators')
4 |
5 | // to get true both statements should be true
6 | console.log(2 > 1 && 4 < 5)
7 | console.log(2 < 1 && 4 < 5)
8 | console.log(2 < 1 && 4 > 5)
9 |
10 | // to get true , just only one statement should be true
11 | console.log(2 > 1 || 4 < 5)
12 | console.log(2 > 1 || 4 > 5)
13 | console.log(2 < 1 || 4 > 5)
14 |
15 | // negation
16 |
17 | console.log(!(2 > 1))
18 |
19 | console.log(3 + (3 - 1) * 5)
20 | console.log(!!false)
21 |
22 |
--------------------------------------------------------------------------------
/week7/oop-1.js:
--------------------------------------------------------------------------------
1 | // OOP: Object Oriented Programming
2 | // Chair, Table, Car, Person
3 | // Chair: iron/plastic/wood, 4/3,
4 | // Car: color, make, model, gear box
5 | // Dog: color, breed, legs, age, gender, bark
6 | // Person: firstName, lastName, age, nationality, etc
7 |
8 | class Animal {
9 | constructor(name, age, breed) {
10 | this.name = name;
11 | this.age = age;
12 | this.breed = breed;
13 | }
14 | bark() {
15 | return 'It wolfs';
16 | }
17 | }
18 |
19 | const a1 = new Animal('Puppy', 4, 'Husky');
20 | const a2 = new Animal('Fluffy', 6, 'Pug');
21 |
22 | console.log(a1);
23 | console.log(a2);
24 | console.log(a1.bark());
25 |
--------------------------------------------------------------------------------
/week8/hoisting.js:
--------------------------------------------------------------------------------
1 | /* scope:
2 |
3 | English -> Global
4 | Finnish -> local
5 |
6 | when it comes variables we diffferent scope: Global and local scope
7 |
8 | */
9 |
10 | const PI = Math.PI
11 | let a = 5
12 |
13 | if(a > 0) {
14 |
15 | let b = 5
16 | let a = 1
17 | let result = a * b
18 | console.log(result)
19 | }
20 |
21 | console.log(a)
22 | a = 3
23 | console.log(a)
24 |
25 | for(let i = 0; i < 3; i++){
26 |
27 | let a = 9
28 | }
29 |
30 | function func() {
31 | var c = 33
32 | let b = 4
33 | return 'something'
34 | }
35 |
36 |
37 | // Draw conclusion
38 | // let and const are block scope but are var is function scoped.
39 |
40 |
--------------------------------------------------------------------------------
/week5/dom-number.js:
--------------------------------------------------------------------------------
1 |
2 | const container = document.getElementById('container')
3 | container.style.display = 'flex'
4 | container.style.flexWrap ='wrap'
5 | container.style.justifyContent = 'center'
6 |
7 | for(let i = 0; i < 1000; i++){
8 | let div = document.createElement('div')
9 | div.textContent = i
10 | div.style.width = '100px'
11 | div.style.height = '100px'
12 | div.style.color = 'white'
13 | div.style.fontSize = '42px'
14 | div.style.textAlign = 'center'
15 | div.style.lineHeight = '100px'
16 |
17 | if(i % 2 === 0){
18 | div.style.background = 'green'
19 | } else {
20 | div.style.background = 'red'
21 | }
22 | container.appendChild(div)
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/week6/revision-HOF.js:
--------------------------------------------------------------------------------
1 | // function makeSquare(n) {
2 | // return n * n
3 | // }
4 |
5 | const makeSquare = (n) => n * n
6 |
7 |
8 | console.log(makeSquare(2) * 2)
9 | // 2 * 2 * 2
10 |
11 | const makeCube = (func, n) => {
12 | return func(n) * n
13 | }
14 |
15 | console.log(makeCube(makeSquare, 3))
16 |
17 | const numbers = [1, 2, 3, 4,5]
18 |
19 |
20 |
21 | numbers.forEach((item) => console.log(item * item))
22 |
23 | const squaredNums = numbers.map((item) => {
24 | return [item, item * item]
25 | })
26 |
27 | console.log(squaredNums)
28 |
29 | const evens = numbers.filter((num) => num % 2 !== 0)
30 | console.log(evens)
31 |
32 | const total = numbers.reduce((acc, cur) => acc + cur)
33 | console.log(total)
34 |
35 |
--------------------------------------------------------------------------------
/week8/functions.js:
--------------------------------------------------------------------------------
1 | /* to write a function that take unlimited number of arguments and return the sum of the arguments
2 |
3 | sumAllNums(1, 2, 4, 5, 8, 9, 10)
4 | */
5 |
6 |
7 |
8 | function sumAllNums() {
9 | console.log(this)
10 | let sum = 0
11 | for (const num of arguments){
12 | sum += num
13 | }
14 | return sum
15 |
16 | }
17 |
18 | console.log(sumAllNums(1, 3, 5, 10, 25, 4))
19 |
20 |
21 | /*
22 | const sumAllNums = (...args) => args.reduce((a, b) => a + b)
23 | console.log(sumAllNums(1, 3, 5, 10, 25, 4))
24 | */
25 |
26 | const makeSquare = () => {
27 | console.log(this)
28 | }
29 |
30 | makeSquare()
31 |
32 | const person = {
33 | firstName:'Asab',
34 | lastName:'Yetayeh',
35 | getPersonInfo: () => {
36 | console.log(this)
37 | }
38 | }
39 |
40 | person.getPersonInfo()
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/week5/dom.js:
--------------------------------------------------------------------------------
1 | const container = document.getElementById('container')
2 |
3 |
4 | for(const country of countriesObj){
5 |
6 | let div = document.createElement('div')
7 | let divContent = document.createElement('div')
8 | let name = document.createElement('span')
9 | let capital = document.createElement('span')
10 | let population = document.createElement('span')
11 |
12 | name.textContent = country.name
13 | capital.textContent = country.capital
14 | population.textContent = country.population
15 |
16 |
17 | divContent.appendChild(name)
18 | divContent.appendChild(population)
19 | divContent.appendChild(capital)
20 |
21 | div.appendChild(divContent)
22 |
23 | let divFlag = document.createElement('div')
24 | let flag = document.createElement('img')
25 | flag.src = country.flag
26 | divFlag.appendChild(flag)
27 | div.appendChild(divFlag)
28 |
29 | container.appendChild(div)
30 | }
31 |
32 |
--------------------------------------------------------------------------------
/week8/fetch.js:
--------------------------------------------------------------------------------
1 |
2 | const container = document.getElementById('container')
3 | const result = document.getElementById('result')
4 | const url = 'https://restcountries.eu/rest/v2/all'
5 |
6 | const createCountryUI = ({name, capital, population, flag}) => {
7 | return (`
8 |
9 | ${name}
10 | ${capital}
11 | ${population}
12 |
13 |
14 |
15 |
16 |
`)
17 | }
18 |
19 |
20 | let content = ''
21 |
22 | fetch(url).then(function(response){
23 | return response.json()
24 | }).then((countries) => {
25 | container.textContent = countries.length
26 | for(const country of countries){
27 | content += createCountryUI(country)
28 | }
29 | container.innerHTML = content
30 | }).catch((error) => {
31 | console.log(error)
32 | })
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/week5/dom-raondom-hexa.js:
--------------------------------------------------------------------------------
1 |
2 | const genHexaColor = () => {
3 | let str = '0123456789abcdef'
4 | let hexa = ''
5 | for(let i = 0; i < 6; i++){
6 | let index = Math.floor(Math.random() * str.length)
7 | hexa = hexa + str[index]
8 | }
9 | return '#' + hexa
10 | }
11 |
12 | const container = document.getElementById('container')
13 | container.style.display = 'flex'
14 | container.style.flexWrap ='wrap'
15 | container.style.justifyContent = 'center'
16 |
17 | for(let i = 0; i < 1000; i++){
18 | let div = document.createElement('div')
19 | let color = genHexaColor()
20 | div.textContent = color
21 | div.style.width = '100px'
22 | div.style.height = '100px'
23 | div.style.color = 'white'
24 | div.style.fontSize = '18px'
25 | div.style.textAlign = 'center'
26 | div.style.lineHeight = '100px'
27 | div.style.backgroundColor = color
28 | container.appendChild(div)
29 |
30 | }
31 |
32 |
--------------------------------------------------------------------------------
/week7/oop-2-setting-getter.js:
--------------------------------------------------------------------------------
1 | class Person {
2 | constructor(firstName, lastName, age) {
3 | this.firstName = firstName;
4 | this.lastName = lastName;
5 | this.age = age;
6 | this.skills = [];
7 | }
8 | set addSkill(skill) {
9 | this.skills.push(skill);
10 | }
11 | getSkills() {
12 | return this.skills;
13 | }
14 | get getPersonInf() {
15 | return `I am ${this.firstName} ${this.lastName}. I am ${
16 | this.age
17 | } years old. I love teaching ${this.skills.join()}.`;
18 | }
19 | }
20 |
21 | const p1 = new Person('Asabeneh', 'Yetayeh', 250);
22 | const p2 = new Person('John', 'Doe', 25);
23 |
24 | console.log(p1.firstName);
25 | console.log(p1.lastName);
26 | console.log(p2);
27 | console.log(p1.skills);
28 | p1.addSkill = 'HTML';
29 | p1.addSkill = 'CSS';
30 | p1.addSkill = 'JS';
31 | /*
32 | p1.addSkill('HTML')
33 | p1.addSkill('CSS')
34 | p1.addSkill('JavaScript')
35 | */
36 | console.log(p1.getSkills());
37 | console.log(p1.getPersonInf);
38 |
--------------------------------------------------------------------------------
/week8/promise.js:
--------------------------------------------------------------------------------
1 | /*
2 | ->
3 | ->
4 | ->
5 | ->
6 | */
7 | setTimeout(() => {
8 | console.log('I will come after 3 seconds')
9 | }, 3000)
10 |
11 | console.log('I will go and wait for you there. ')
12 |
13 |
14 | /* async await */
15 |
16 |
17 | // promise > fullfilled rejected pending
18 |
19 | const makeSquare = (n) => n ** 2
20 | console.log(makeSquare(3) * 3)
21 | const makeCube = (n, func) => {
22 | return n * func(n)
23 | }
24 |
25 | console.log(makeCube(10, makeSquare))
26 |
27 | let promise = new Promise(function(resolve, reject) {
28 |
29 | const skills = ['HTML', 'CSS']
30 | if(skills.length >= 3){
31 | console.log(resolve('You can attend the react course'))
32 |
33 | } else {
34 | console.log(reject(`${skills.join(',')} are not enough for attending React`))
35 |
36 | }
37 |
38 |
39 | })
40 |
41 | promise.then((value) => {
42 | console.log(value)
43 | }).catch((value) => {
44 | console.log('here ?')
45 | console.log(value)
46 | })
47 |
--------------------------------------------------------------------------------
/week6/countries-object-dom.js:
--------------------------------------------------------------------------------
1 | const container = document.getElementById('container')
2 | const termInput = document.getElementById('term')
3 |
4 | const createContent = (arr) => {
5 | return ( `
6 |
7 | ${arr.name}
8 | ${arr.capital}
9 | ${arr.population}
10 |
11 |
12 |
13 |
14 |
`)
15 |
16 | }
17 |
18 | const createCountriesUI = (arr) => {
19 | let content = ''
20 | for(const country of arr){
21 | content += createContent(country)
22 | }
23 | console.log(content)
24 | container.innerHTML = content
25 | }
26 |
27 | createCountriesUI(countriesObj)
28 | termInput.addEventListener('input', (e) => {
29 | filteredCountries = countriesObj.filter((country) => country.name.toLowerCase().includes(e.target.value.toLowerCase()))
30 | container.innerHTML = ''
31 | createCountriesUI(filteredCountries)
32 | })
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/week3/functions.js:
--------------------------------------------------------------------------------
1 |
2 | /// function declaration
3 | // function doSomeThing () {
4 | // return 'I am teaching'
5 | // }
6 |
7 | // expression function
8 | // const doSomeThing = function () {
9 | // return 'I am teaching'
10 | // }
11 |
12 | // Arrow function
13 | const doSomeThing = () => 'I am teaching'
14 | console.log(doSomeThing())
15 |
16 |
17 | // function addTwoNumber(a, b){
18 | // let sum = a + b
19 | // return sum
20 | // }
21 |
22 | // const addTwoNumber = function(a, b){
23 | // let sum = a + b
24 | // return sum
25 | // }
26 |
27 | const addTwoNumber = (a, b) => a + b
28 |
29 | console.log(addTwoNumber(1, 4))
30 | console.log(addTwoNumber(1, 99))
31 | console.log(addTwoNumber(10, 90))
32 |
33 | // makeSquare(n), write this fucntin in three way
34 | // function makeSquare (n) {
35 | // return n ** 2
36 |
37 | // }
38 | // const makeSquare = function (n) {
39 | // return n ** 2
40 | // }
41 | const makeSquare = (n) => n ** 2
42 |
43 | console.log(makeSquare(10))
44 | console.log(makeSquare(9))
45 |
--------------------------------------------------------------------------------
/week5/dom.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DOM
5 |
23 |
24 |
25 |
29 |
30 |
31 |
32 |
33 |
34 |
37 |
38 |
--------------------------------------------------------------------------------
/week6/dom-two-input-fields.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | DOM:Creating HTML Elements
8 |
9 |
10 |
11 |
12 |
13 | Find weight
14 |
15 |
16 |
17 |
33 |
34 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | JavaScript Spring 2021
8 |
9 |
10 |
11 |
12 | Modern JavaScript
13 |
14 |
15 |
16 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/week6/dom-getting_revision.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | DOM
8 |
11 |
12 |
13 | DOCUMENT OBJECT MODEL LESSON
14 | First let us learn getting elements
15 | Then we will learn creating elements
16 | Then after we will learn setting attributes
17 |
18 |
19 |
20 |
33 |
34 |
--------------------------------------------------------------------------------
/week6/single-input-field.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | DOM:Creating HTML Elements
8 |
9 |
10 |
11 |
12 | Calculate
13 |
14 |
15 |
16 |
45 |
46 |
--------------------------------------------------------------------------------
/week8/async-await.js:
--------------------------------------------------------------------------------
1 |
2 | const container = document.getElementById('container')
3 | const result = document.getElementById('result')
4 | const createCountryUI = ({name, capital, population, flag}) => {
5 | return `
6 |
7 | ${name}
8 | ${capital}
9 | ${population}
10 |
11 |
12 |
13 |
14 |
`
15 | }
16 |
17 | /*
18 | let content = ''
19 | fetch(url).then(function(response){
20 | return response.json()
21 | }).then((countries) => {
22 | container.textContent = countries.length
23 | for(const country of countries){
24 | content += createCountryUI(country)
25 | }
26 | container.innerHTML = content
27 | }).catch((error) => {
28 | console.log(error)
29 | })
30 | */
31 |
32 | let content = ''
33 | async function fetchData () {
34 | const url = 'https://restcountries.eu/rest/v2/all'
35 | const response = await fetch(url)
36 | const data = await response.json()
37 | container.textContent = data.length
38 | for(const country of data){
39 | content += createCountryUI(country)
40 | }
41 | container.innerHTML = content
42 | }
43 |
44 | fetchData()
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/notes.md:
--------------------------------------------------------------------------------
1 |
2 | Assignment Operator: =
3 | Arithmetic Operators:
4 | comparison operator: >, <, >=, <=, ==, ===, !==, !=
5 | Week 3: TOPICS
6 |
7 | Logical Operators
8 | Conditionals
9 | Arrays
10 | Loops
11 | Functions
12 |
13 | ## Week 4
14 |
15 | - Revision,conditions, loops, functions
16 | - Object
17 |
18 | ## Week 5
19 |
20 | - Revision of Object
21 | - Revision of loops(for, while, do while, forEach, for of, for in)
22 | - Higher Order Functions
23 | - Date Object
24 | - Sets and Maps
25 | - Destructuring and Spreading
26 | - DOM
27 |
28 | ## Week 6
29 |
30 | - Revision of last
31 | - Higher Order function revision
32 | - More on DOM(getting elements, creating elements, adding attributes, handle events)
33 |
34 | ## Week 7
35 |
36 | - Set and Map
37 | - Object Oriented Programming(Class and Object)
38 | - Destructuring and spreading
39 | - Working on DOM project
40 |
41 |
42 | Go to Asabeneh GitHub account and create a data structure for the following repos:30DaysOfPython, 30DaysOfReact, 30DaysOfJavaScript, Python for Everyone, JavaScript for Everyone and React for Everyone
43 |
44 | # Week
45 | - Fetch
46 | - Promise
47 | - Set and Map
48 | - Hoisting
49 | - var, let, const
50 | - Regular Expression
51 | - Function declaration versus arrow function
52 |
--------------------------------------------------------------------------------
/week8/fetch.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | World Countries data
8 |
35 |
36 |
37 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/week8/async-await.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | World Countries data
8 |
35 |
36 |
37 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/week6/change-background-color.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | DOM
8 |
9 |
10 |
11 | DOM Random Background Hexacolors
12 | Change Background
13 |
14 |
54 |
55 |
--------------------------------------------------------------------------------
/week6/countries-object-dom-backup.js:
--------------------------------------------------------------------------------
1 | const container = document.getElementById('container')
2 | const termInput = document.getElementById('term')
3 | console.log(termInput.value)
4 |
5 |
6 | let filteredCountries = []
7 |
8 | const createCountriesUI = (data) => {
9 | for(const country of data){
10 | let div = document.createElement('div')
11 | let divContent = document.createElement('div')
12 | let name = document.createElement('span')
13 | let capital = document.createElement('span')
14 | let population = document.createElement('span')
15 |
16 | name.textContent = country.name
17 | capital.textContent = country.capital
18 | population.textContent = country.population
19 |
20 | divContent.appendChild(name)
21 | divContent.appendChild(population)
22 | divContent.appendChild(capital)
23 |
24 | div.appendChild(divContent)
25 |
26 | let divFlag = document.createElement('div')
27 | let flag = document.createElement('img')
28 | flag.src = country.flag
29 | divFlag.appendChild(flag)
30 | div.appendChild(divFlag)
31 |
32 | container.appendChild(div)
33 | }
34 | }
35 |
36 |
37 | createCountriesUI(countriesObj)
38 |
39 | termInput.addEventListener('input', (e) => {
40 |
41 | filteredCountries = countriesObj.filter((country) => country.name.toLowerCase().includes(e.target.value.toLowerCase()))
42 |
43 | container.innerHTML = ''
44 | createCountriesUI(filteredCountries)
45 |
46 | })
47 |
48 |
--------------------------------------------------------------------------------
/week3/loops.js:
--------------------------------------------------------------------------------
1 | // what are loops?
2 | // why need them?
3 | // to repeat,
4 |
5 | console.log('Hello world!')
6 |
7 | // For loop
8 | /*
9 | for (initional, conditon, increm/decrem) {
10 |
11 | }
12 |
13 | */
14 |
15 |
16 | for(let i = 1; i <= 10; i = i + 1){
17 | console.log(`${i} ^ ${i} = ${i ** i}`)
18 | }
19 |
20 |
21 | /*
22 | 1 x 1 = 1
23 | 2 x 2 = 4
24 | */
25 |
26 | for(let i = 5; i >= 0; i--){
27 | console.log(i, i * i, i ** i)
28 | }
29 |
30 | // while loop
31 |
32 | /*
33 | let count = 0
34 | while (condtion){
35 | console.log('sss')
36 | increment/decr
37 | }
38 | 0
39 | 1
40 | 2
41 | 3
42 |
43 |
44 | */
45 | let count = 0
46 | while (count <= 3){
47 | console.log('count: ', count)
48 | count++
49 | }
50 |
51 | /*
52 | first do and check
53 | let k = 0
54 | do {
55 | console.log(k)
56 | k++
57 | } while (k <= 3)
58 |
59 | */
60 |
61 | let k = 4
62 | do {
63 | console.log('k',k)
64 | k++
65 | } while (k <= 3)
66 |
67 | const shoppingCart = ['Mango', 'Milk','Honey','Sugar','Coffee','Meat']
68 |
69 | const newProducts = []
70 |
71 | for (let i = 0; i < shoppingCart.length; i++){
72 | if (shoppingCart[i].length === 4) {
73 | newProducts.push(shoppingCart[i])
74 | }
75 | }
76 | console.log(newProducts)
77 |
78 |
79 | const newArr = []
80 | for(let i = shoppingCart.length - 1; i >= 0; i--){
81 | newArr.push(shoppingCart[i])
82 | }
83 | console.log(newArr)
84 |
85 |
--------------------------------------------------------------------------------
/week6/world-countries-data.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DOM
5 |
32 |
33 |
34 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
48 |
49 |
--------------------------------------------------------------------------------
/week8/regex.js:
--------------------------------------------------------------------------------
1 |
2 | const str = 'Love is the most important thing in this world. If you do not love it is hard to live. So just start to love something.'
3 |
4 | let pattern = /love/gi
5 |
6 | const match = str.match(pattern)
7 | console.log(match)
8 | console.log(str.replace(pattern, 'hate'))
9 |
10 | // test => true false
11 | // match => null or array
12 | // search => index or -1
13 | // replace => it replace a substring
14 | console.log(str.replace(pattern, ''))
15 |
16 | const paragraph = `I love teaching. If you do not love teaching what else can you love. I love Python if you do not love something which can give you all the capabilities to develop an application what else can you love.`
17 |
18 | const findMostFreqWords = (txt, n) => {
19 | const freqTable = {}
20 | const arr =[]
21 | const words = txt.replace(/[^\w\d\s]/g, '').toLowerCase().split(' ')
22 | for(const word of words){
23 | if(freqTable[word]){
24 | freqTable[word] += 1
25 | } else {
26 | freqTable[word] = 1
27 | }
28 | }
29 | for (const key in freqTable){
30 | arr.push({word:key, count:freqTable[key]})
31 | }
32 |
33 | // copying the array and sorting
34 |
35 | const sortedArr = arr.slice().sort((a, b) => {
36 | if (a.count < b.count) return 1;
37 | if (a.count > b.count) return -1;
38 | return 0;
39 | })
40 | return sortedArr.slice(0, n)
41 |
42 | }
43 | console.log(findMostFreqWords(paragraph, 3))
44 |
45 |
--------------------------------------------------------------------------------
/week5/revision-objects.js:
--------------------------------------------------------------------------------
1 | let firstName = 'Asab'
2 | let lastName = 'Yeta'
3 | let age = 250
4 | let isMarried = true
5 |
6 | // Object => property:model, type, color, manual,
7 | // person: tall, firstName, lastName, age, hair, color, ....
8 |
9 | // Object
10 |
11 | const person = {
12 | firstName:'Asabeneh',
13 | lastName:'Yetayeh',
14 | age:250,
15 | country:'Finland',
16 | city:'Helsinki',
17 | skills:['HTML','CSS','JS','React'],
18 | getPersonInfo:function(){
19 | return `${this.firstName} ${ this.lastName}. His skill are ${this.skills.join()}`
20 | }
21 | }
22 | console.log(person)
23 | console.log(person.firstName)
24 | console.log(person['firstName'])
25 | console.log(person['lastName'])
26 | console.log(person.nationality)
27 | person.nationality = 'Ethiopian'
28 | console.log(person.nationality)
29 | console.log(person)
30 | console.log('what is the output from her?', person.getPersonInfo())
31 |
32 | // Object Methods
33 | // hasOwnProperty, Object.keys, Object.values, Object.assign, entries
34 | const keys = Object.keys(person)
35 | console.log(keys)
36 | const values = Object.values(person)
37 |
38 | console.log(values)
39 | console.log(person.hasOwnProperty('firstName'))
40 |
41 | if(person.hasOwnProperty('skills')){
42 | person.skills.push('React')
43 | }
44 | console.log(person)
45 |
46 | const entries = Object.entries(person)
47 | console.log(entries)
48 |
49 | const p1 = Object.assign({}, person, {city:'Espoo'} )
50 | console.log(p1)
51 |
52 |
--------------------------------------------------------------------------------
/week7/world-countries-data.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DOM
5 |
32 |
33 |
34 |
38 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
53 |
54 |
--------------------------------------------------------------------------------
/week7/oop-inheritance.js:
--------------------------------------------------------------------------------
1 | class Person {
2 | constructor(firstName, lastName, age) {
3 | this.firstName = firstName;
4 | this.lastName = lastName;
5 | this.age = age;
6 | this.skills = ['Disciple'];
7 | }
8 | addSkill(skill) {
9 | this.skills.push(skill);
10 | }
11 | getSkills() {
12 | return this.skills;
13 | }
14 | getPersonInf() {
15 | return `I am ${this.firstName} ${this.lastName}. I am ${
16 | this.age
17 | } years old. I love teaching ${this.skills.join(', ')}.`;
18 | }
19 | }
20 |
21 | const p1 = new Person('Asabeneh', 'Yetayeh', 250);
22 | const p2 = new Person('John', 'Doe', 25);
23 |
24 | console.log(p1.firstName);
25 | console.log(p1.lastName);
26 | console.log(p2);
27 | console.log(p1.skills);
28 |
29 | p1.addSkill('HTML');
30 | p1.addSkill('CSS');
31 | p1.addSkill('JavaScript');
32 | console.log(p1.getSkills());
33 | console.log(p1.getPersonInf());
34 |
35 | // Inheritance: Cheap
36 | //
37 |
38 | class Student extends Person {
39 | constructor(firstName, lastName, age, nationality) {
40 | super(firstName, lastName, age);
41 | this.nationality = nationality;
42 | }
43 | addmethod() {}
44 | getPersonInf() {
45 | return `I am ${this.firstName} ${this.lastName}. I am ${
46 | this.age
47 | } years old. I love teaching ${this.skills.join()}. My nationality is ${
48 | this.nationality
49 | }.`;
50 | }
51 | }
52 |
53 | const s1 = new Student('James', 'John', 21, 'British');
54 | console.log(s1);
55 | s1.addSkill('JavaScript');
56 | s1.addSkill('React');
57 | console.log(s1.getSkills());
58 | console.log(s1.getPersonInf());
59 | console.log(s1.getSkills());
60 |
--------------------------------------------------------------------------------
/week3/arrays.js:
--------------------------------------------------------------------------------
1 | let nums = [1, 2, 3]
2 |
3 | // accessing array items
4 | console.log(nums)
5 | console.log(nums[0])
6 | console.log(nums[1])
7 | console.log(nums[2])
8 | console.log(nums.length)
9 |
10 | let lastIndex = nums.length - 1
11 | console.log(nums[lastIndex])
12 |
13 | // modifiy items in the array
14 | // nums[0] = -5
15 | // console.log(nums)
16 | // nums[1] = 'Potato'
17 | // console.log(nums)
18 | // nums[lastIndex] = 300
19 | // console.log(nums)
20 |
21 | console.log(nums)
22 |
23 | // push, pop, shift, unshift
24 | // nums.push(4)
25 | // console.log(nums)
26 | // nums.unshift(-10)
27 | // console.log(nums)
28 | // nums.pop()
29 | // console.log(nums)
30 | // nums.shift()
31 | // console.log(nums)
32 | // push, unshif, pop, shift, slice
33 |
34 | // arr.splice(index, number, item to be added)
35 |
36 | // splice: three index, howmany, item to be added
37 |
38 | // nums.splice(0)
39 | // console.log(nums)
40 |
41 | // slice and splice
42 |
43 | console.log(nums.slice())
44 | console.log(nums.slice(0,2))
45 | let nums_copy = nums.slice()
46 |
47 | // String dataty
48 |
49 | let firstName = 'Asabeneh'
50 | let lastName = 'Yetayeh'
51 | let fullName = firstName + ' ' + lastName
52 | let country = 'Finland'
53 | let city = 'Helsinki'
54 | let age = 250
55 |
56 | // Asabeneh Yetayeh lives in Helsinki, Finland. He is 250 years old.
57 |
58 | console.log(fullName + ' lives in ' + city + ', ' + country + '.' + ' He is ' + age + ' years old.')
59 |
60 | // String interpolation
61 |
62 | console.log(`${fullName} lives in ${city}, ${country}. He is ${age} years old. `)
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/week5/functional-programming.js:
--------------------------------------------------------------------------------
1 | // map, filter, reduce, find, findIndex, some, every
2 |
3 | const nums = [1, 2, 3, 4, 5]
4 | //[1, 4, 9, 16, 25]
5 |
6 | // long way
7 | const newArr = []
8 | for(let i = 0; i < nums.length ;i++){
9 | newArr.push(nums[i] * nums[i])
10 | }
11 |
12 | console.log(newArr)
13 |
14 | // shorter way using map
15 | const numsSquared = nums.map((item) => item * item)
16 |
17 | // Filter
18 | const evens = nums.filter((item) => item % 2 == 0)
19 |
20 | console.log(numsSquared)
21 | console.log(evens)
22 |
23 |
24 | // long way
25 | let total = 0
26 | for (const num of nums){
27 | console.log(`${num} ${total}`)
28 | total = total + num
29 | }
30 | console.log(total)
31 |
32 | // Shorter way
33 | const totalValue = nums.reduce((acc, curr) => acc * curr, 1)
34 |
35 | console.log(totalValue)
36 |
37 | let three = nums.find((item) => item > 3)
38 | console.log(three)
39 | let indexOfThree = nums.findIndex((item) => item ==3)
40 | console.log(indexOfThree)
41 |
42 | console.log(nums.every((num) => num > 0))
43 |
44 | const now = new Date ()
45 | const year = now.getFullYear()
46 | const month = now.getMonth() + 1
47 | const date = now.getDate()
48 | const hours = now.getHours()
49 | const minutes = now.getMinutes()
50 |
51 |
52 | console.log(now.getFullYear())
53 | console.log(now.getMonth() + 1)
54 | console.log(now.getDate())
55 | console.log(now.getDay())
56 | console.log(now.getHours())
57 | console.log(now.getMinutes())
58 | console.log(`${year}/${month}/${date}`)
59 | console.log(`${date}/${month}/${year}`)
60 | console.log(`${date}/${month}/${year} ${hours}:${minutes}`)
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/week7/countries-object-dom.js:
--------------------------------------------------------------------------------
1 | const title = document.getElementById('title')
2 | const result = document.getElementById('result')
3 | title.style.textAlign = 'center'
4 | title.textContent = `The total number of the countries are ${countriesObj.length}`
5 |
6 | const container = document.getElementById('container');
7 | const termInput = document.getElementById('term')
8 |
9 | const createContent = ({name, capital, population, flag}) => {
10 | return ( `
11 |
12 | ${name}
13 | ${capital}
14 | ${population}
15 |
16 |
17 |
18 |
19 |
`)
20 | }
21 |
22 | const createCountriesUI = (arr) => {
23 | let content = ''
24 | for(const country of arr){
25 | content += createContent(country)
26 | }
27 | container.innerHTML = content
28 | }
29 |
30 | createCountriesUI(countriesObj)
31 | termInput.addEventListener('input', (e) => {
32 | filteredCountries = countriesObj.filter(
33 | ({ name, capital, languages}) => {
34 | console.log(capital)
35 | return name.toLowerCase().includes(e.target.value.toLowerCase()) ||
36 | capital.toLowerCase().includes(e.target.value.toLowerCase()) ||
37 | languages.join(',').toLowerCase().includes(e.target.value.toLowerCase());
38 | }
39 |
40 | )
41 | container.innerHTML = ''
42 | result.textContent = `The result based on the search term is ${filteredCountries.length}`
43 | createCountriesUI(filteredCountries)
44 | })
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/graph.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
74 |
75 |
--------------------------------------------------------------------------------
/week3/conditionals.js:
--------------------------------------------------------------------------------
1 | // CONDITOIONS
2 |
3 | let a = 5
4 |
5 | // Lets write a js script that check if a number is positive, negative or zero
6 |
7 | if(a > 0){
8 | console.log('It is a positive number')
9 | } else if(a == 0) {
10 | console.log('The number is zero')
11 | } else if( a < 0) {
12 | console.log('It is a negative number')
13 | }
14 | else {
15 | console.log('Unknown')
16 | }
17 |
18 | // more on if else, switch , ternary
19 |
20 |
21 | // let weather = prompt('Enter weather: ', 'Enter some text here ..').toLowerCase()
22 |
23 | // if(weather == 'rainy'){
24 | // console.log('Yes, it is raining')
25 | // } else if(weather == 'sunny') {
26 | // console.log('It is such a shinny day, just go out freely')
27 | // } else if( weather =='foggy'){
28 | // console.log('It just foggy, gloomy and cloudy day.')
29 | // } else if(weather =='snowy'){
30 | // console.log('It might be too cold')
31 | // }
32 | // else {
33 | // console.log('No one knows about today weather condition')
34 | // }
35 |
36 | // SWITCH
37 | // switch (weather) {
38 |
39 |
40 | // // the code goes here
41 |
42 | // case 'rainy':
43 | // console.log('Yes, it is raining')
44 | // break
45 | // case 'sunny':
46 | // console.log('It is such a shinny day, just go out freely')
47 | // break
48 | // case 'foggy':
49 | // console.log('It just foggy, gloomy and cloudy day.')
50 | // break
51 | // case 'snowy':
52 | // console.log('It might be too cold')
53 | // break
54 | // default:
55 | // console.log('No one knows about today weather condition')
56 | // }
57 |
58 | // Ternary
59 |
60 | let firstName = 'Eyob'
61 |
62 | let value = firstName.length > 5 ? 'Long': 'Short'
63 | console.log()
64 | console.log(value)
65 |
--------------------------------------------------------------------------------
/week6/dom-creating-revision.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | DOM:Creating HTML Elements
8 |
9 |
10 |
11 |
12 | Calculate
13 |
14 |
15 |
16 |
88 |
89 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 |
2 | # Modern JavaScript
3 |
4 | ## Week 1
5 |
6 | Introduction
7 |
8 | 1. What are the core technologies of web development?
9 | 2. What is programming?
10 | 3. What is the acronym HTML stands for?
11 | 4. Are HTML and CSS programming languages?
12 | 5. Is JavaScript a programming language?
13 | 6. What is HTML element, what is an HTML attribute? List some examples
14 | 7. Which element is the root of an HTML document? How many immediate children the root HTML element has?
15 | 8. What is the purpose of HTML in a website?
16 | 9. What is acronym CSS stands for?
17 | 10. What is the purpose of CSS in a website?
18 | 11. Where do you write your CSS?
19 | 12. What is the role JavaScript in web development?
20 | 13. What is DOM stands for and what does really mean?
21 | 14. What tag do you use to write JavaScript code
22 | 15. Where can you write a JavaScript code
23 | 16. Install VSCode and write JavaScript code VScode
24 | 17. Write some JavaScript code inside the head
25 | 18. Write some inline script
26 | 19. Write some JavaScript on Chrome Browser console
27 | 20. Install node and write JavaScript code on the Node repl
28 |
29 |
30 |
31 | ## Week 2
32 |
33 |
34 | Functions
35 |
36 | 1. What is a function?
37 | - A block of code that allows you to perform a certain task
38 | 2. Functions can be divided into two: builtin functions and custom functions
39 | 3. Write at least 10 builtin functions and perform some task using the function
40 |
41 |
42 |
43 |
44 | Comments
45 |
46 | 1 What is the use of a comment in programming
47 | - To make the code readable, maintainable, reusable, to leave remark
48 | 2. Write a single line JavaScript comment
49 | 3. Write a multiline JavaScript comment
50 |
51 |
52 |
53 |
54 | Data types
55 |
56 | 1. List all the data types you know
57 | 2. Give one example for each data types
58 |
59 |
60 |
61 |
62 | Variables
63 |
64 | - Declare a variable of all data types
65 | - Check the type of your variables using type
66 |
67 |
68 |
69 |
70 | Operations
71 |
72 | What is an assignment operator?
73 | What are the JavaScript Arithmetic operators?
74 | What are the JavaScript comparison operators > < >= <= == !==,
75 | What are the JavaScript logical operators ?
76 |
77 |
78 |
79 |
80 | Checking data types and Type casting
81 |
82 | ```sh
83 | let numInt = 10
84 | let numStr = '5'
85 | let gravity = 9.81
86 | ```
87 | 1. Change the value at numInt to float
88 | 2. Change the value at numInt to string
89 | 3. Change the value at gravity to integer
90 | 4. Change the value at gravity to string
91 | 5. Change the numStr to to int
92 | 6. Change the numStr to float
93 |
94 |
95 |
--------------------------------------------------------------------------------
/week5/further-on-loops.js:
--------------------------------------------------------------------------------
1 | // Regular loop
2 |
3 |
4 | // it prints from 1 to 10
5 | for(let i = 1; i < 11; i = i + 5){
6 | console.log(i)
7 | }
8 |
9 | // it prints from 10 to 1
10 | for(let i = 10; i >= 1; i--){
11 | console.log(i)
12 | }
13 |
14 |
15 |
16 | // prints 0 to 10
17 | let count = 0
18 | while (count < 11) {
19 | console.log(count )
20 | count++
21 | }
22 |
23 |
24 |
25 |
26 | // prints 1 to 10
27 | let k = 1
28 | do {
29 | console.log(k )
30 | k++
31 | } while (k < 11)
32 |
33 |
34 |
35 | const arr = []
36 | while (arr.length!=10) {
37 | arr.push()
38 | }
39 |
40 |
41 |
42 | const items = ['Mango', 'Milk','Honey','Sugar','Coffee','Meat']
43 |
44 | console.log('Regular for LOOP')
45 | for(let i = 0; i < items.length; i++){
46 | console.log(i + 1, items[i].toUpperCase())
47 | }
48 |
49 | console.log('forEach Loop')
50 | items.forEach(function(item){
51 | console.log(item)
52 | })
53 |
54 |
55 |
56 | // looping using for of
57 | for(const item of items){
58 | console.log(item.toUpperCase())
59 | }
60 |
61 |
62 | const user = {
63 | name:'JOHN',
64 | age:25,
65 | skills:['HTML', 'CSS','JS']
66 | }
67 |
68 | // loop using for in with object
69 | for (const key in user){
70 | console.log(key, user[key])
71 | }
72 |
73 | const users = {
74 | Alex: {
75 | email: 'alex@alex.com',
76 | skills: ['HTML', 'CSS', 'JavaScript'],
77 | age: 20,
78 | isLoggedIn: false,
79 | points: 30
80 | },
81 | Asab: {
82 | email: 'asab@asab.com',
83 | skills: ['HTML', 'CSS', 'JavaScript', 'React', 'Redux', 'Node.js'],
84 | age: 25,
85 | isLoggedIn: false,
86 | points: 50
87 | },
88 | Brook: {
89 | email: 'daniel@daniel.com',
90 | skills: ['HTML', 'CSS', 'JavaScript', 'React', 'Redux'],
91 | age: 30,
92 | isLoggedIn: true,
93 | points: 50
94 | },
95 | Daniel: {
96 | email: 'daniel@alex.com',
97 | skills: ['HTML', 'CSS', 'JavaScript', 'Python'],
98 | age: 20,
99 | isLoggedIn: false,
100 | points: 40
101 | },
102 | John: {
103 | email: 'john@john.com',
104 | skills: ['HTML', 'CSS', 'JavaScript', 'React', 'Redux', 'Node.js'],
105 | age: 20,
106 | isLoggedIn: true,
107 | points: 50
108 | },
109 | Thomas: {
110 | email: 'thomas@thomas.com',
111 | skills: ['HTML', 'CSS', 'JavaScript', 'React'],
112 | age: 20,
113 | isLoggedIn: false,
114 | points: 40
115 | }
116 | };
117 |
118 |
119 | let arr = []
120 | for(const key in users){
121 | let point = users[key].points
122 | if(point >= 50) {
123 | arr.push(point)
124 | }
125 | }
126 | console.log(arr)
127 | console.log(arr.length)
128 |
129 | // Higher Order Function: Is a function that takes another function as a parameter or return a function
130 |
131 | // const makeSquare = (n) => n ** 2
132 |
133 | // function cube(func, n){
134 | // return func(n) * n
135 | // }
136 |
137 | // console.log(cube(makeSquare, 3))
138 |
139 |
140 | function xyz (x, y){
141 | return {
142 | sum:(x, y) => x + y,
143 | product: (x,y) => x * y
144 | }
145 | }
146 |
147 | console.log(xyz().product(2, 30))
148 | console.log(xyz().sum(99, 1))
149 |
150 | // Functional Programming: map, filter, reduce, some, any, find, findIndex
151 |
152 |
153 |
154 |
--------------------------------------------------------------------------------
/week7/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
141 |
142 |
--------------------------------------------------------------------------------
/week2/variables.js:
--------------------------------------------------------------------------------
1 | // What is a variable
2 | // variable is a storage that stores data the may be use and
3 |
4 | // var, let, const
5 | // we can use _ and $ with our variable names
6 | // camelCase
7 |
8 | // Arithmetic Operations: +, -, *, /, %, **
9 | // =
10 | // comparisons: >, <, >=, <=, ==, ===, !=, !===
11 |
12 | let a = 3
13 | let b = 2
14 |
15 | let sum = a + b
16 | let diff = a - b
17 | let prod = a * b
18 | let div = a / b
19 | let remainder = a % b
20 | let exponential = a ** b
21 |
22 |
23 | let sentence = "I just love JavaScript. Because with JavaScript, i can do almost anything."
24 |
25 | let currentYear = 2021
26 | let firstName = 'John'
27 | let lastName = 'Doe'
28 | let space = ' '
29 | let fullName = firstName + space + lastName
30 | console.log('The sum is ', sum)
31 | console.log('The difference', diff)
32 | console.log('The product is ', prod)
33 | console.log('The div', div)
34 | console.log('The exponential', exponential)
35 | console.log('The full name is ', fullName)
36 |
37 |
38 | // Guys, find the area of a circle
39 | // area = pi * r * r
40 |
41 | const PI = Math.PI
42 | let r = 10
43 | let area1 = PI * r * r
44 |
45 | console.log(area1)
46 |
47 |
48 | // calculate the area of a rectangle with length 10 and width 20
49 | // perimeter
50 | let length = 20
51 | let width = 10
52 | let areaRect = length * width
53 | let perimeter = 2 * (length + width)
54 |
55 | console.log(areaRect)
56 | console.log(perimeter)
57 |
58 | // caculate the weight of an object on planet Earth, gravity is 9.81 and mass is 75 kg
59 |
60 | const gravity = 9.81
61 | let mass = 75
62 | let weight = mass * gravity
63 |
64 | console.log('The weight of the body on planet Earth is ', weight)
65 |
66 |
67 | // value that can be true or false
68 |
69 | console.log(3 > 2)
70 | console.log(3 >= 2)
71 | console.log(2 < 3)
72 | console.log(2 <= 3)
73 | console.log(2 == 3)
74 |
75 | console.log(2 == 2)
76 | console.log(2 == '2')
77 | console.log(2 === '2')
78 | console.log(2 === 2)
79 |
80 | // Data types: Number, String, Boolean, null, undefined, Object
81 |
82 | // Number: Int, float
83 | let num1 = 3
84 | let num2 = 4
85 | let pi = 3.14
86 |
87 | // bultin function
88 |
89 | console.log(Math.round(pi))
90 |
91 |
92 |
93 | let randValue = Math.floor(Math.random() * 11)
94 |
95 | console.log(randValue)
96 |
97 | console.log(Math.sqrt(4))
98 | console.log(Math.sqrt(9))
99 | console.log(Math.sqrt(2))
100 |
101 | let now = new Date()
102 | console.log(now.getFullYear())
103 |
104 | console.log(now.getMonth())
105 | console.log(now.getHours())
106 | console.log(now.getMinutes())
107 |
108 | // Boolean data types: true or false
109 |
110 | // what punctions marks do we use to make a string: single quote, double quote, back stick
111 |
112 | let letter = 'a'
113 | let para = ` I love JavaScript `
114 |
115 | console.log(letter.length)
116 | console.log(para.length)
117 |
118 | console.log(letter.toLowerCase())
119 | console.log(letter.toUpperCase())
120 | console.log(para.toUpperCase())
121 | console.log(para.includes('Love'))
122 | console.log(para.endsWith('Script'))
123 | console.log(para.split(' '))
124 | console.log(para)
125 | console.log(para.trim())
126 |
127 |
128 | let value = null
129 |
130 | let country
131 | console.log(country)
132 |
133 | country = 'Finland'
134 |
135 | console.log(country)
136 |
137 | let city = undefined
138 |
139 | // array, functions, objects
140 |
141 |
142 |
143 | typeof(10)
--------------------------------------------------------------------------------
/data/countries-array.js:
--------------------------------------------------------------------------------
1 | const countries = [
2 | 'Afghanistan',
3 | 'Albania',
4 | 'Algeria',
5 | 'Andorra',
6 | 'Angola',
7 | 'Antigua and Barbuda',
8 | 'Argentina',
9 | 'Armenia',
10 | 'Australia',
11 | 'Austria',
12 | 'Azerbaijan',
13 | 'Bahamas',
14 | 'Bahrain',
15 | 'Bangladesh',
16 | 'Barbados',
17 | 'Belarus',
18 | 'Belgium',
19 | 'Belize',
20 | 'Benin',
21 | 'Bhutan',
22 | 'Bolivia',
23 | 'Bosnia and Herzegovina',
24 | 'Botswana',
25 | 'Brazil',
26 | 'Brunei',
27 | 'Bulgaria',
28 | 'Burkina Faso',
29 | 'Burundi',
30 | 'Cambodia',
31 | 'Cameroon',
32 | 'Canada',
33 | 'Cape Verde',
34 | 'Central African Republic',
35 | 'Chad',
36 | 'Chile',
37 | 'China',
38 | 'Colombi',
39 | 'Comoros',
40 | 'Congo (Brazzaville)',
41 | 'Congo',
42 | 'Costa Rica',
43 | "Cote d'Ivoire",
44 | 'Croatia',
45 | 'Cuba',
46 | 'Cyprus',
47 | 'Czech Republic',
48 | 'Denmark',
49 | 'Djibouti',
50 | 'Dominica',
51 | 'Dominican Republic',
52 | 'East Timor (Timor Timur)',
53 | 'Ecuador',
54 | 'Egypt',
55 | 'El Salvador',
56 | 'Equatorial Guinea',
57 | 'Eritrea',
58 | 'Estonia',
59 | 'Ethiopia',
60 | 'Fiji',
61 | 'Finland',
62 | 'France',
63 | 'Gabon',
64 | 'Gambia, The',
65 | 'Georgia',
66 | 'Germany',
67 | 'Ghana',
68 | 'Greece',
69 | 'Grenada',
70 | 'Guatemala',
71 | 'Guinea',
72 | 'Guinea-Bissau',
73 | 'Guyana',
74 | 'Haiti',
75 | 'Honduras',
76 | 'Hungary',
77 | 'Iceland',
78 | 'India',
79 | 'Indonesia',
80 | 'Iran',
81 | 'Iraq',
82 | 'Ireland',
83 | 'Israel',
84 | 'Italy',
85 | 'Jamaica',
86 | 'Japan',
87 | 'Jordan',
88 | 'Kazakhstan',
89 | 'Kenya',
90 | 'Kiribati',
91 | 'Korea, North',
92 | 'Korea, South',
93 | 'Kuwait',
94 | 'Kyrgyzstan',
95 | 'Laos',
96 | 'Latvia',
97 | 'Lebanon',
98 | 'Lesotho',
99 | 'Liberia',
100 | 'Libya',
101 | 'Liechtenstein',
102 | 'Lithuania',
103 | 'Luxembourg',
104 | 'Macedonia',
105 | 'Madagascar',
106 | 'Malawi',
107 | 'Malaysia',
108 | 'Maldives',
109 | 'Mali',
110 | 'Malta',
111 | 'Marshall Islands',
112 | 'Mauritania',
113 | 'Mauritius',
114 | 'Mexico',
115 | 'Micronesia',
116 | 'Moldova',
117 | 'Monaco',
118 | 'Mongolia',
119 | 'Morocco',
120 | 'Mozambique',
121 | 'Myanmar',
122 | 'Namibia',
123 | 'Nauru',
124 | 'Nepal',
125 | 'Netherlands',
126 | 'New Zealand',
127 | 'Nicaragua',
128 | 'Niger',
129 | 'Nigeria',
130 | 'Norway',
131 | 'Oman',
132 | 'Pakistan',
133 | 'Palau',
134 | 'Panama',
135 | 'Papua New Guinea',
136 | 'Paraguay',
137 | 'Peru',
138 | 'Philippines',
139 | 'Poland',
140 | 'Portugal',
141 | 'Qatar',
142 | 'Romania',
143 | 'Russia',
144 | 'Rwanda',
145 | 'Saint Kitts and Nevis',
146 | 'Saint Lucia',
147 | 'Saint Vincent',
148 | 'Samoa',
149 | 'San Marino',
150 | 'Sao Tome and Principe',
151 | 'Saudi Arabia',
152 | 'Senegal',
153 | 'Serbia and Montenegro',
154 | 'Seychelles',
155 | 'Sierra Leone',
156 | 'Singapore',
157 | 'Slovakia',
158 | 'Slovenia',
159 | 'Solomon Islands',
160 | 'Somalia',
161 | 'South Africa',
162 | 'Spain',
163 | 'Sri Lanka',
164 | 'Sudan',
165 | 'Suriname',
166 | 'Swaziland',
167 | 'Sweden',
168 | 'Switzerland',
169 | 'Syria',
170 | 'Taiwan',
171 | 'Tajikistan',
172 | 'Tanzania',
173 | 'Thailand',
174 | 'Togo',
175 | 'Tonga',
176 | 'Trinidad and Tobago',
177 | 'Tunisia',
178 | 'Turkey',
179 | 'Turkmenistan',
180 | 'Tuvalu',
181 | 'Uganda',
182 | 'Ukraine',
183 | 'United Arab Emirates',
184 | 'United Kingdom',
185 | 'United States',
186 | 'Uruguay',
187 | 'Uzbekistan',
188 | 'Vanuatu',
189 | 'Vatican City',
190 | 'Venezuela',
191 | 'Vietnam',
192 | 'Yemen',
193 | 'Zambia',
194 | 'Zimbabwe'
195 | ]
--------------------------------------------------------------------------------
/week4/revision-condition-function-loops.js:
--------------------------------------------------------------------------------
1 | // conditions => descion making
2 | // some condition => time
3 |
4 | function checkNumber (n) {
5 | let result = ''
6 | if(n > 0) {
7 | result = 'positive'
8 | } else if ( n === 0) {
9 | result = 'zero'
10 | } else if ( n < 0) {
11 | result = 'negative'
12 | }
13 | else {
14 | result = 'Not a number'
15 | }
16 | return result
17 | }
18 |
19 | function getWeatherCondition(weather) {
20 | weather = weather.toLowerCase()
21 | let result = ''
22 | if(weather === 'rainy') result = 'Take your umbrella'
23 | else if (weather === 'cloudy') result = 'It is just cloudy and a high probability of rain'
24 | else if (weather === 'windy') result = 'It is very windy, take care of yourself you taken'
25 | else if (weather === 'snowy') result = 'It is just full of snow'
26 | else if (weather ==='sunny') result = 'It is just a shiny day go out freely. Enjoy your day!'
27 |
28 | else {
29 | result = 'It is just a shiny day go out freely. Enjoy your day!'
30 | }
31 | return result
32 | }
33 |
34 | // console.log(checkNumber(1))
35 | // console.log(checkNumber(-1))
36 | // console.log(checkNumber(0))
37 |
38 | // console.log(getWeatherCondition('suNnY'))
39 | // console.log(getWeatherCondition('snowy'))
40 |
41 |
42 | function getWeatherCondition_2 (weather) {
43 | weather = weather. toLowerCase()
44 | switch(weather) {
45 | case 'showery':
46 | case 'dripping':
47 | case 'rainy':
48 | return 'Take your umbrella'
49 | case 'sunny':
50 | return 'It is just a shiny day go out freely. Enjoy your day!'
51 | case 'snowy':
52 | return 'It is just full of snow'
53 | case 'windy':
54 | return 'It is very windy, take care of yourself you taken'
55 | case 'cloudy':
56 | return 'It is just cloudy and a high probability of rain'
57 | default:
58 | return 'It is just a shiny day go out freely. Enjoy your day!'
59 | }
60 | }
61 |
62 | console.log(getWeatherCondition_2('dripping'))
63 | console.log(getWeatherCondition_2('showery'))
64 |
65 | // Ternary => x, y , z
66 |
67 | let name = 'Eyob'
68 |
69 | let value = name.length > 5 ? 'Long Name': 'Short Name'
70 | console.log(value)
71 |
72 | // Loops, functions
73 |
74 | function generateEvenNums (n) {
75 | const evens = []
76 | for(let i = 0; i <= n; i = i + 2){
77 | evens.push(i)
78 | }
79 | return evens
80 | }
81 |
82 | console.log(generateEvenNums(1000))
83 |
84 | for(let i = 5; i >= 0; i--){
85 | console.log(i)
86 | }
87 | // [2, 5, 6, 7, 0] => [0, 7, 6, 5, 2]
88 | function reverseArray(arr){
89 |
90 | let newArr = []
91 | for(let i = arr.length-1; i >= 0; i--){
92 | newArr.push(arr[i])
93 | }
94 | return newArr
95 |
96 | }
97 |
98 | console.log(reverseArray([2, 5, 6, 7, 0]))
99 |
100 |
101 | // who does not know how to declare ?
102 |
103 | /*
104 | function printFullName(firstName, lasteName){
105 | return firstName + ' ' + lasteName
106 | }
107 | */
108 | /*
109 | // function expression
110 | const printFullName = function (firstName, lasteName){
111 | return firstName + ' ' + lasteName
112 | }
113 | */
114 | /*
115 | const printFullName = (firstName, lasteName) => {
116 | return firstName + ' ' + lasteName
117 | }
118 | */
119 | const printFullName = (firstName, lasteName) => firstName + ' ' + lasteName
120 |
121 | console.log(printFullName('Asab','Yeta'))
122 | console.log(printFullName('Donald J.', 'Trump'))
123 |
124 |
125 | // calculate the weight of an object on any planet ? name of the function calculateWeight, it returns the weight of the object as string(eg 700.55 N), gravity of Earth = 9.81, weight = mass * gravity
126 |
127 |
128 | const calculateWeight = (mass, gravity = 9.81) => {
129 | let w = mass * gravity
130 | return `${w.toFixed(1)} N`
131 | }
132 |
133 | console.log(calculateWeight(75.45))
134 | console.log(calculateWeight(75.45, 1.62))
135 |
136 | // calculate the area of a circle. The area of circle can be calculated as area = pi * r * r, calculateAreaOfCircle, it returns a string 180 m2
137 |
138 | const calAreaOfCircle = (radius) => {
139 | area = Math.PI * radius ** 2
140 | return `The area of the circle with ${radius} m radius is ${area.toFixed(2)} m2.`
141 | }
142 |
143 | console.log(calAreaOfCircle(100))
144 |
145 | // Global Objects
146 |
147 | console.log(Math.sqrt(4))
148 | console.log(Math.sqrt(2))
149 | console.log(Math.random()) // 0 to 0.999999
150 | console.log(Math.round(9.81))
151 | console.log(Math.floor(9.81))
152 | console.log(Math.ceil(3.14))
153 |
154 | // generate array of 7 random numbers ?
155 |
156 | const generateSevenNums = (n = 7) => {
157 | const nums = []
158 | for (let i = 0; i < n; i++) nums.push(Math.floor(Math.random() * 11))
159 | return nums
160 | }
161 |
162 | console.log(generateSevenNums(25))
163 |
164 | /* Objects */
165 |
166 |
167 | const person = {
168 | firstName:'Asabeneh',
169 | lastName:'Yetayeh',
170 | country : 'Finland',
171 | city : 'Helsinki',
172 | age : 250,
173 | skills : ['HTML','CSS','JavaScript'],
174 | favoriteFoods : ['Tuna','Salmon','Potatoes','Mango','Avocado'],
175 | getPersonInfo:function(job){
176 | return `${this.firstName} ${this.lastName} lives in ${this.country}, ${this.city}. He is a ${job}`
177 | },
178 | hobbies:'teaching, talking'
179 | }
180 |
181 | console.log(person)
182 | console.log(person.age)
183 | console.log(person.favoriteFoods[0])
184 | console.log(person.nationality)
185 |
186 | person.nationality = 'Ethiopian'
187 |
188 | console.log(person.nationality)
189 | console.log(person.getPersonInfo('Instructor'))
190 |
191 | // Object methods:keys, values, entities, hasOwnProperty
192 |
193 | console.log(Object.keys(person))
194 | const keys = Object.keys(person)
195 | console.log(keys)
196 | console.log(Object.values(person))
197 | const entries= Object.entries(person)
198 | console.log(entries)
199 |
200 | console.log(person.hasOwnProperty('hobbies'))
201 |
202 | const personAccount = {
203 | firstName:'Asabeneh',
204 | lastName:'Yetayeh',
205 | incomes:[{
206 | description:'Salary',
207 | amount:'3500'
208 | },
209 | {
210 | description:'Sold house',
211 | amount:'35000'
212 | },
213 | {
214 | description:'Book Sale',
215 | amount:'10000'
216 | },
217 | ],
218 | expenses:[{
219 | description:'Rend',
220 | amount:'1500'
221 | },
222 | {
223 | description:'Transport',
224 | amount:'150'
225 | },
226 |
227 | ],
228 | addIncome: function () {
229 |
230 | },
231 | addExpense: function () {
232 |
233 | },
234 | totalIncome: function () {
235 |
236 | },
237 | totalExpense: function() {
238 |
239 | }
240 |
241 | }
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
--------------------------------------------------------------------------------
/data/countries-object.js:
--------------------------------------------------------------------------------
1 | const countriesObj = [
2 | {
3 | name: 'Afghanistan',
4 | capital: 'Kabul',
5 | languages: ['Pashto', 'Uzbek', 'Turkmen'],
6 | population: 27657145,
7 | flag: 'https://restcountries.eu/data/afg.svg',
8 | currency: 'Afghan afghani'
9 | },
10 | {
11 | name: 'Åland Islands',
12 | capital: 'Mariehamn',
13 | languages: ['Swedish'],
14 | population: 28875,
15 | flag: 'https://restcountries.eu/data/ala.svg',
16 | currency: 'Euro'
17 | },
18 | {
19 | name: 'Albania',
20 | capital: 'Tirana',
21 | languages: ['Albanian'],
22 | population: 2886026,
23 | flag: 'https://restcountries.eu/data/alb.svg',
24 | currency: 'Albanian lek'
25 | },
26 | {
27 | name: 'Algeria',
28 | capital: 'Algiers',
29 | languages: ['Arabic'],
30 | population: 40400000,
31 | flag: 'https://restcountries.eu/data/dza.svg',
32 | currency: 'Algerian dinar'
33 | },
34 | {
35 | name: 'American Samoa',
36 | capital: 'Pago Pago',
37 | languages: ['English', 'Samoan'],
38 | population: 57100,
39 | flag: 'https://restcountries.eu/data/asm.svg',
40 | currency: 'United State Dollar'
41 | },
42 | {
43 | name: 'Andorra',
44 | capital: 'Andorra la Vella',
45 | languages: ['Catalan'],
46 | population: 78014,
47 | flag: 'https://restcountries.eu/data/and.svg',
48 | currency: 'Euro'
49 | },
50 | {
51 | name: 'Angola',
52 | capital: 'Luanda',
53 | languages: ['Portuguese'],
54 | population: 25868000,
55 | flag: 'https://restcountries.eu/data/ago.svg',
56 | currency: 'Angolan kwanza'
57 | },
58 | {
59 | name: 'Anguilla',
60 | capital: 'The Valley',
61 | languages: ['English'],
62 | population: 13452,
63 | flag: 'https://restcountries.eu/data/aia.svg',
64 | currency: 'East Caribbean dollar'
65 | },
66 | {
67 | name: 'Antarctica',
68 | capital: '',
69 | languages: ['English', 'Russian'],
70 | population: 1000,
71 | flag: 'https://restcountries.eu/data/ata.svg',
72 | currency: 'Australian dollar'
73 | },
74 | {
75 | name: 'Antigua and Barbuda',
76 | capital: "Saint John's",
77 | languages: ['English'],
78 | population: 86295,
79 | flag: 'https://restcountries.eu/data/atg.svg',
80 | currency: 'East Caribbean dollar'
81 | },
82 | {
83 | name: 'Argentina',
84 | capital: 'Buenos Aires',
85 | languages: ['Spanish', 'Guaraní'],
86 | population: 43590400,
87 | flag: 'https://restcountries.eu/data/arg.svg',
88 | currency: 'Argentine peso'
89 | },
90 | {
91 | name: 'Armenia',
92 | capital: 'Yerevan',
93 | languages: ['Armenian', 'Russian'],
94 | population: 2994400,
95 | flag: 'https://restcountries.eu/data/arm.svg',
96 | currency: 'Armenian dram'
97 | },
98 | {
99 | name: 'Aruba',
100 | capital: 'Oranjestad',
101 | languages: ['Dutch', '(Eastern) Punjabi'],
102 | population: 107394,
103 | flag: 'https://restcountries.eu/data/abw.svg',
104 | currency: 'Aruban florin'
105 | },
106 | {
107 | name: 'Australia',
108 | capital: 'Canberra',
109 | languages: ['English'],
110 | population: 24117360,
111 | flag: 'https://restcountries.eu/data/aus.svg',
112 | currency: 'Australian dollar'
113 | },
114 | {
115 | name: 'Austria',
116 | capital: 'Vienna',
117 | languages: ['German'],
118 | population: 8725931,
119 | flag: 'https://restcountries.eu/data/aut.svg',
120 | currency: 'Euro'
121 | },
122 | {
123 | name: 'Azerbaijan',
124 | capital: 'Baku',
125 | languages: ['Azerbaijani'],
126 | population: 9730500,
127 | flag: 'https://restcountries.eu/data/aze.svg',
128 | currency: 'Azerbaijani manat'
129 | },
130 | {
131 | name: 'Bahamas',
132 | capital: 'Nassau',
133 | languages: ['English'],
134 | population: 378040,
135 | flag: 'https://restcountries.eu/data/bhs.svg',
136 | currency: 'Bahamian dollar'
137 | },
138 | {
139 | name: 'Bahrain',
140 | capital: 'Manama',
141 | languages: ['Arabic'],
142 | population: 1404900,
143 | flag: 'https://restcountries.eu/data/bhr.svg',
144 | currency: 'Bahraini dinar'
145 | },
146 | {
147 | name: 'Bangladesh',
148 | capital: 'Dhaka',
149 | languages: ['Bengali'],
150 | population: 161006790,
151 | flag: 'https://restcountries.eu/data/bgd.svg',
152 | currency: 'Bangladeshi taka'
153 | },
154 | {
155 | name: 'Barbados',
156 | capital: 'Bridgetown',
157 | languages: ['English'],
158 | population: 285000,
159 | flag: 'https://restcountries.eu/data/brb.svg',
160 | currency: 'Barbadian dollar'
161 | },
162 | {
163 | name: 'Belarus',
164 | capital: 'Minsk',
165 | languages: ['Belarusian', 'Russian'],
166 | population: 9498700,
167 | flag: 'https://restcountries.eu/data/blr.svg',
168 | currency: 'New Belarusian ruble'
169 | },
170 | {
171 | name: 'Belgium',
172 | capital: 'Brussels',
173 | languages: ['Dutch', 'French', 'German'],
174 | population: 11319511,
175 | flag: 'https://restcountries.eu/data/bel.svg',
176 | currency: 'Euro'
177 | },
178 | {
179 | name: 'Belize',
180 | capital: 'Belmopan',
181 | languages: ['English', 'Spanish'],
182 | population: 370300,
183 | flag: 'https://restcountries.eu/data/blz.svg',
184 | currency: 'Belize dollar'
185 | },
186 | {
187 | name: 'Benin',
188 | capital: 'Porto-Novo',
189 | languages: ['French'],
190 | population: 10653654,
191 | flag: 'https://restcountries.eu/data/ben.svg',
192 | currency: 'West African CFA franc'
193 | },
194 | {
195 | name: 'Bermuda',
196 | capital: 'Hamilton',
197 | languages: ['English'],
198 | population: 61954,
199 | flag: 'https://restcountries.eu/data/bmu.svg',
200 | currency: 'Bermudian dollar'
201 | },
202 | {
203 | name: 'Bhutan',
204 | capital: 'Thimphu',
205 | languages: ['Dzongkha'],
206 | population: 775620,
207 | flag: 'https://restcountries.eu/data/btn.svg',
208 | currency: 'Bhutanese ngultrum'
209 | },
210 | {
211 | name: 'Bolivia (Plurinational State of)',
212 | capital: 'Sucre',
213 | languages: ['Spanish', 'Aymara', 'Quechua'],
214 | population: 10985059,
215 | flag: 'https://restcountries.eu/data/bol.svg',
216 | currency: 'Bolivian boliviano'
217 | },
218 | {
219 | name: 'Bonaire, Sint Eustatius and Saba',
220 | capital: 'Kralendijk',
221 | languages: ['Dutch'],
222 | population: 17408,
223 | flag: 'https://restcountries.eu/data/bes.svg',
224 | currency: 'United States dollar'
225 | },
226 | {
227 | name: 'Bosnia and Herzegovina',
228 | capital: 'Sarajevo',
229 | languages: ['Bosnian', 'Croatian', 'Serbian'],
230 | population: 3531159,
231 | flag: 'https://restcountries.eu/data/bih.svg',
232 | currency: 'Bosnia and Herzegovina convertible mark'
233 | },
234 | {
235 | name: 'Botswana',
236 | capital: 'Gaborone',
237 | languages: ['English', 'Tswana'],
238 | population: 2141206,
239 | flag: 'https://restcountries.eu/data/bwa.svg',
240 | currency: 'Botswana pula'
241 | },
242 | {
243 | name: 'Bouvet Island',
244 | capital: '',
245 | languages: ['Norwegian', 'Norwegian Bokmål', 'Norwegian Nynorsk'],
246 | population: 0,
247 | flag: 'https://restcountries.eu/data/bvt.svg',
248 | currency: 'Norwegian krone'
249 | },
250 | {
251 | name: 'Brazil',
252 | capital: 'Brasília',
253 | languages: ['Portuguese'],
254 | population: 206135893,
255 | flag: 'https://restcountries.eu/data/bra.svg',
256 | currency: 'Brazilian real'
257 | },
258 | {
259 | name: 'British Indian Ocean Territory',
260 | capital: 'Diego Garcia',
261 | languages: ['English'],
262 | population: 3000,
263 | flag: 'https://restcountries.eu/data/iot.svg',
264 | currency: 'United States dollar'
265 | },
266 | {
267 | name: 'United States Minor Outlying Islands',
268 | capital: '',
269 | languages: ['English'],
270 | population: 300,
271 | flag: 'https://restcountries.eu/data/umi.svg',
272 | currency: 'United States Dollar'
273 | },
274 | {
275 | name: 'Virgin Islands (British)',
276 | capital: 'Road Town',
277 | languages: ['English'],
278 | population: 28514,
279 | flag: 'https://restcountries.eu/data/vgb.svg',
280 | currency: '[D]'
281 | },
282 | {
283 | name: 'Virgin Islands (U.S.)',
284 | capital: 'Charlotte Amalie',
285 | languages: ['English'],
286 | population: 114743,
287 | flag: 'https://restcountries.eu/data/vir.svg',
288 | currency: 'United States dollar'
289 | },
290 | {
291 | name: 'Brunei Darussalam',
292 | capital: 'Bandar Seri Begawan',
293 | languages: ['Malay'],
294 | population: 411900,
295 | flag: 'https://restcountries.eu/data/brn.svg',
296 | currency: 'Brunei dollar'
297 | },
298 | {
299 | name: 'Bulgaria',
300 | capital: 'Sofia',
301 | languages: ['Bulgarian'],
302 | population: 7153784,
303 | flag: 'https://restcountries.eu/data/bgr.svg',
304 | currency: 'Bulgarian lev'
305 | },
306 | {
307 | name: 'Burkina Faso',
308 | capital: 'Ouagadougou',
309 | languages: ['French', 'Fula'],
310 | population: 19034397,
311 | flag: 'https://restcountries.eu/data/bfa.svg',
312 | currency: 'West African CFA franc'
313 | },
314 | {
315 | name: 'Burundi',
316 | capital: 'Bujumbura',
317 | languages: ['French', 'Kirundi'],
318 | population: 10114505,
319 | flag: 'https://restcountries.eu/data/bdi.svg',
320 | currency: 'Burundian franc'
321 | },
322 | {
323 | name: 'Cambodia',
324 | capital: 'Phnom Penh',
325 | languages: ['Khmer'],
326 | population: 15626444,
327 | flag: 'https://restcountries.eu/data/khm.svg',
328 | currency: 'Cambodian riel'
329 | },
330 | {
331 | name: 'Cameroon',
332 | capital: 'Yaoundé',
333 | languages: ['English', 'French'],
334 | population: 22709892,
335 | flag: 'https://restcountries.eu/data/cmr.svg',
336 | currency: 'Central African CFA franc'
337 | },
338 | {
339 | name: 'Canada',
340 | capital: 'Ottawa',
341 | languages: ['English', 'French'],
342 | population: 36155487,
343 | flag: 'https://restcountries.eu/data/can.svg',
344 | currency: 'Canadian dollar'
345 | },
346 | {
347 | name: 'Cabo Verde',
348 | capital: 'Praia',
349 | languages: ['Portuguese'],
350 | population: 531239,
351 | flag: 'https://restcountries.eu/data/cpv.svg',
352 | currency: 'Cape Verdean escudo'
353 | },
354 | {
355 | name: 'Cayman Islands',
356 | capital: 'George Town',
357 | languages: ['English'],
358 | population: 58238,
359 | flag: 'https://restcountries.eu/data/cym.svg',
360 | currency: 'Cayman Islands dollar'
361 | },
362 | {
363 | name: 'Central African Republic',
364 | capital: 'Bangui',
365 | languages: ['French', 'Sango'],
366 | population: 4998000,
367 | flag: 'https://restcountries.eu/data/caf.svg',
368 | currency: 'Central African CFA franc'
369 | },
370 | {
371 | name: 'Chad',
372 | capital: "N'Djamena",
373 | languages: ['French', 'Arabic'],
374 | population: 14497000,
375 | flag: 'https://restcountries.eu/data/tcd.svg',
376 | currency: 'Central African CFA franc'
377 | },
378 | {
379 | name: 'Chile',
380 | capital: 'Santiago',
381 | languages: ['Spanish'],
382 | population: 18191900,
383 | flag: 'https://restcountries.eu/data/chl.svg',
384 | currency: 'Chilean peso'
385 | },
386 | {
387 | name: 'China',
388 | capital: 'Beijing',
389 | languages: ['Chinese'],
390 | population: 1377422166,
391 | flag: 'https://restcountries.eu/data/chn.svg',
392 | currency: 'Chinese yuan'
393 | },
394 | {
395 | name: 'Christmas Island',
396 | capital: 'Flying Fish Cove',
397 | languages: ['English'],
398 | population: 2072,
399 | flag: 'https://restcountries.eu/data/cxr.svg',
400 | currency: 'Australian dollar'
401 | },
402 | {
403 | name: 'Cocos (Keeling) Islands',
404 | capital: 'West Island',
405 | languages: ['English'],
406 | population: 550,
407 | flag: 'https://restcountries.eu/data/cck.svg',
408 | currency: 'Australian dollar'
409 | },
410 | {
411 | name: 'Colombia',
412 | capital: 'Bogotá',
413 | languages: ['Spanish'],
414 | population: 48759958,
415 | flag: 'https://restcountries.eu/data/col.svg',
416 | currency: 'Colombian peso'
417 | },
418 | {
419 | name: 'Comoros',
420 | capital: 'Moroni',
421 | languages: ['Arabic', 'French'],
422 | population: 806153,
423 | flag: 'https://restcountries.eu/data/com.svg',
424 | currency: 'Comorian franc'
425 | },
426 | {
427 | name: 'Congo',
428 | capital: 'Brazzaville',
429 | languages: ['French', 'Lingala'],
430 | population: 4741000,
431 | flag: 'https://restcountries.eu/data/cog.svg',
432 | currency: 'Central African CFA franc'
433 | },
434 | {
435 | name: 'Congo (Democratic Republic of the)',
436 | capital: 'Kinshasa',
437 | languages: ['French', 'Lingala', 'Kongo', 'Swahili', 'Luba-Katanga'],
438 | population: 85026000,
439 | flag: 'https://restcountries.eu/data/cod.svg',
440 | currency: 'Congolese franc'
441 | },
442 | {
443 | name: 'Cook Islands',
444 | capital: 'Avarua',
445 | languages: ['English'],
446 | population: 18100,
447 | flag: 'https://restcountries.eu/data/cok.svg',
448 | currency: 'New Zealand dollar'
449 | },
450 | {
451 | name: 'Costa Rica',
452 | capital: 'San José',
453 | languages: ['Spanish'],
454 | population: 4890379,
455 | flag: 'https://restcountries.eu/data/cri.svg',
456 | currency: 'Costa Rican colón'
457 | },
458 | {
459 | name: 'Croatia',
460 | capital: 'Zagreb',
461 | languages: ['Croatian'],
462 | population: 4190669,
463 | flag: 'https://restcountries.eu/data/hrv.svg',
464 | currency: 'Croatian kuna'
465 | },
466 | {
467 | name: 'Cuba',
468 | capital: 'Havana',
469 | languages: ['Spanish'],
470 | population: 11239004,
471 | flag: 'https://restcountries.eu/data/cub.svg',
472 | currency: 'Cuban convertible peso'
473 | },
474 | {
475 | name: 'Curaçao',
476 | capital: 'Willemstad',
477 | languages: ['Dutch', '(Eastern) Punjabi', 'English'],
478 | population: 154843,
479 | flag: 'https://restcountries.eu/data/cuw.svg',
480 | currency: 'Netherlands Antillean guilder'
481 | },
482 | {
483 | name: 'Cyprus',
484 | capital: 'Nicosia',
485 | languages: ['Greek (modern)', 'Turkish', 'Armenian'],
486 | population: 847000,
487 | flag: 'https://restcountries.eu/data/cyp.svg',
488 | currency: 'Euro'
489 | },
490 | {
491 | name: 'Czech Republic',
492 | capital: 'Prague',
493 | languages: ['Czech', 'Slovak'],
494 | population: 10558524,
495 | flag: 'https://restcountries.eu/data/cze.svg',
496 | currency: 'Czech koruna'
497 | },
498 | {
499 | name: 'Denmark',
500 | capital: 'Copenhagen',
501 | languages: ['Danish'],
502 | population: 5717014,
503 | flag: 'https://restcountries.eu/data/dnk.svg',
504 | currency: 'Danish krone'
505 | },
506 | {
507 | name: 'Djibouti',
508 | capital: 'Djibouti',
509 | languages: ['French', 'Arabic'],
510 | population: 900000,
511 | flag: 'https://restcountries.eu/data/dji.svg',
512 | currency: 'Djiboutian franc'
513 | },
514 | {
515 | name: 'Dominica',
516 | capital: 'Roseau',
517 | languages: ['English'],
518 | population: 71293,
519 | flag: 'https://restcountries.eu/data/dma.svg',
520 | currency: 'East Caribbean dollar'
521 | },
522 | {
523 | name: 'Dominican Republic',
524 | capital: 'Santo Domingo',
525 | languages: ['Spanish'],
526 | population: 10075045,
527 | flag: 'https://restcountries.eu/data/dom.svg',
528 | currency: 'Dominican peso'
529 | },
530 | {
531 | name: 'Ecuador',
532 | capital: 'Quito',
533 | languages: ['Spanish'],
534 | population: 16545799,
535 | flag: 'https://restcountries.eu/data/ecu.svg',
536 | currency: 'United States dollar'
537 | },
538 | {
539 | name: 'Egypt',
540 | capital: 'Cairo',
541 | languages: ['Arabic'],
542 | population: 91290000,
543 | flag: 'https://restcountries.eu/data/egy.svg',
544 | currency: 'Egyptian pound'
545 | },
546 | {
547 | name: 'El Salvador',
548 | capital: 'San Salvador',
549 | languages: ['Spanish'],
550 | population: 6520675,
551 | flag: 'https://restcountries.eu/data/slv.svg',
552 | currency: 'United States dollar'
553 | },
554 | {
555 | name: 'Equatorial Guinea',
556 | capital: 'Malabo',
557 | languages: ['Spanish', 'French'],
558 | population: 1222442,
559 | flag: 'https://restcountries.eu/data/gnq.svg',
560 | currency: 'Central African CFA franc'
561 | },
562 | {
563 | name: 'Eritrea',
564 | capital: 'Asmara',
565 | languages: ['Tigrinya', 'Arabic', 'English'],
566 | population: 5352000,
567 | flag: 'https://restcountries.eu/data/eri.svg',
568 | currency: 'Eritrean nakfa'
569 | },
570 | {
571 | name: 'Estonia',
572 | capital: 'Tallinn',
573 | languages: ['Estonian'],
574 | population: 1315944,
575 | flag: 'https://restcountries.eu/data/est.svg',
576 | currency: 'Euro'
577 | },
578 | {
579 | name: 'Ethiopia',
580 | capital: 'Addis Ababa',
581 | languages: ['Amharic'],
582 | population: 92206005,
583 | flag: 'https://restcountries.eu/data/eth.svg',
584 | currency: 'Ethiopian birr'
585 | },
586 | {
587 | name: 'Falkland Islands (Malvinas)',
588 | capital: 'Stanley',
589 | languages: ['English'],
590 | population: 2563,
591 | flag: 'https://restcountries.eu/data/flk.svg',
592 | currency: 'Falkland Islands pound'
593 | },
594 | {
595 | name: 'Faroe Islands',
596 | capital: 'Tórshavn',
597 | languages: ['Faroese'],
598 | population: 49376,
599 | flag: 'https://restcountries.eu/data/fro.svg',
600 | currency: 'Danish krone'
601 | },
602 | {
603 | name: 'Fiji',
604 | capital: 'Suva',
605 | languages: ['English', 'Fijian', 'Hindi', 'Urdu'],
606 | population: 867000,
607 | flag: 'https://restcountries.eu/data/fji.svg',
608 | currency: 'Fijian dollar'
609 | },
610 | {
611 | name: 'Finland',
612 | capital: 'Helsinki',
613 | languages: ['Finnish', 'Swedish'],
614 | population: 5491817,
615 | flag: 'https://restcountries.eu/data/fin.svg',
616 | currency: 'Euro'
617 | },
618 | {
619 | name: 'France',
620 | capital: 'Paris',
621 | languages: ['French'],
622 | population: 66710000,
623 | flag: 'https://restcountries.eu/data/fra.svg',
624 | currency: 'Euro'
625 | },
626 | {
627 | name: 'French Guiana',
628 | capital: 'Cayenne',
629 | languages: ['French'],
630 | population: 254541,
631 | flag: 'https://restcountries.eu/data/guf.svg',
632 | currency: 'Euro'
633 | },
634 | {
635 | name: 'French Polynesia',
636 | capital: 'Papeetē',
637 | languages: ['French'],
638 | population: 271800,
639 | flag: 'https://restcountries.eu/data/pyf.svg',
640 | currency: 'CFP franc'
641 | },
642 | {
643 | name: 'French Southern Territories',
644 | capital: 'Port-aux-Français',
645 | languages: ['French'],
646 | population: 140,
647 | flag: 'https://restcountries.eu/data/atf.svg',
648 | currency: 'Euro'
649 | },
650 | {
651 | name: 'Gabon',
652 | capital: 'Libreville',
653 | languages: ['French'],
654 | population: 1802278,
655 | flag: 'https://restcountries.eu/data/gab.svg',
656 | currency: 'Central African CFA franc'
657 | },
658 | {
659 | name: 'Gambia',
660 | capital: 'Banjul',
661 | languages: ['English'],
662 | population: 1882450,
663 | flag: 'https://restcountries.eu/data/gmb.svg',
664 | currency: 'Gambian dalasi'
665 | },
666 | {
667 | name: 'Georgia',
668 | capital: 'Tbilisi',
669 | languages: ['Georgian'],
670 | population: 3720400,
671 | flag: 'https://restcountries.eu/data/geo.svg',
672 | currency: 'Georgian Lari'
673 | },
674 | {
675 | name: 'Germany',
676 | capital: 'Berlin',
677 | languages: ['German'],
678 | population: 81770900,
679 | flag: 'https://restcountries.eu/data/deu.svg',
680 | currency: 'Euro'
681 | },
682 | {
683 | name: 'Ghana',
684 | capital: 'Accra',
685 | languages: ['English'],
686 | population: 27670174,
687 | flag: 'https://restcountries.eu/data/gha.svg',
688 | currency: 'Ghanaian cedi'
689 | },
690 | {
691 | name: 'Gibraltar',
692 | capital: 'Gibraltar',
693 | languages: ['English'],
694 | population: 33140,
695 | flag: 'https://restcountries.eu/data/gib.svg',
696 | currency: 'Gibraltar pound'
697 | },
698 | {
699 | name: 'Greece',
700 | capital: 'Athens',
701 | languages: ['Greek (modern)'],
702 | population: 10858018,
703 | flag: 'https://restcountries.eu/data/grc.svg',
704 | currency: 'Euro'
705 | },
706 | {
707 | name: 'Greenland',
708 | capital: 'Nuuk',
709 | languages: ['Kalaallisut'],
710 | population: 55847,
711 | flag: 'https://restcountries.eu/data/grl.svg',
712 | currency: 'Danish krone'
713 | },
714 | {
715 | name: 'Grenada',
716 | capital: "St. George's",
717 | languages: ['English'],
718 | population: 103328,
719 | flag: 'https://restcountries.eu/data/grd.svg',
720 | currency: 'East Caribbean dollar'
721 | },
722 | {
723 | name: 'Guadeloupe',
724 | capital: 'Basse-Terre',
725 | languages: ['French'],
726 | population: 400132,
727 | flag: 'https://restcountries.eu/data/glp.svg',
728 | currency: 'Euro'
729 | },
730 | {
731 | name: 'Guam',
732 | capital: 'Hagåtña',
733 | languages: ['English', 'Chamorro', 'Spanish'],
734 | population: 184200,
735 | flag: 'https://restcountries.eu/data/gum.svg',
736 | currency: 'United States dollar'
737 | },
738 | {
739 | name: 'Guatemala',
740 | capital: 'Guatemala City',
741 | languages: ['Spanish'],
742 | population: 16176133,
743 | flag: 'https://restcountries.eu/data/gtm.svg',
744 | currency: 'Guatemalan quetzal'
745 | },
746 | {
747 | name: 'Guernsey',
748 | capital: 'St. Peter Port',
749 | languages: ['English', 'French'],
750 | population: 62999,
751 | flag: 'https://restcountries.eu/data/ggy.svg',
752 | currency: 'British pound'
753 | },
754 | {
755 | name: 'Guinea',
756 | capital: 'Conakry',
757 | languages: ['French', 'Fula'],
758 | population: 12947000,
759 | flag: 'https://restcountries.eu/data/gin.svg',
760 | currency: 'Guinean franc'
761 | },
762 | {
763 | name: 'Guinea-Bissau',
764 | capital: 'Bissau',
765 | languages: ['Portuguese'],
766 | population: 1547777,
767 | flag: 'https://restcountries.eu/data/gnb.svg',
768 | currency: 'West African CFA franc'
769 | },
770 | {
771 | name: 'Guyana',
772 | capital: 'Georgetown',
773 | languages: ['English'],
774 | population: 746900,
775 | flag: 'https://restcountries.eu/data/guy.svg',
776 | currency: 'Guyanese dollar'
777 | },
778 | {
779 | name: 'Haiti',
780 | capital: 'Port-au-Prince',
781 | languages: ['French', 'Haitian'],
782 | population: 11078033,
783 | flag: 'https://restcountries.eu/data/hti.svg',
784 | currency: 'Haitian gourde'
785 | },
786 | {
787 | name: 'Heard Island and McDonald Islands',
788 | capital: '',
789 | languages: ['English'],
790 | population: 0,
791 | flag: 'https://restcountries.eu/data/hmd.svg',
792 | currency: 'Australian dollar'
793 | },
794 | {
795 | name: 'Holy See',
796 | capital: 'Rome',
797 | languages: ['Latin', 'Italian', 'French', 'German'],
798 | population: 451,
799 | flag: 'https://restcountries.eu/data/vat.svg',
800 | currency: 'Euro'
801 | },
802 | {
803 | name: 'Honduras',
804 | capital: 'Tegucigalpa',
805 | languages: ['Spanish'],
806 | population: 8576532,
807 | flag: 'https://restcountries.eu/data/hnd.svg',
808 | currency: 'Honduran lempira'
809 | },
810 | {
811 | name: 'Hong Kong',
812 | capital: 'City of Victoria',
813 | languages: ['English', 'Chinese'],
814 | population: 7324300,
815 | flag: 'https://restcountries.eu/data/hkg.svg',
816 | currency: 'Hong Kong dollar'
817 | },
818 | {
819 | name: 'Hungary',
820 | capital: 'Budapest',
821 | languages: ['Hungarian'],
822 | population: 9823000,
823 | flag: 'https://restcountries.eu/data/hun.svg',
824 | currency: 'Hungarian forint'
825 | },
826 | {
827 | name: 'Iceland',
828 | capital: 'Reykjavík',
829 | languages: ['Icelandic'],
830 | population: 334300,
831 | flag: 'https://restcountries.eu/data/isl.svg',
832 | currency: 'Icelandic króna'
833 | },
834 | {
835 | name: 'India',
836 | capital: 'New Delhi',
837 | languages: ['Hindi', 'English'],
838 | population: 1295210000,
839 | flag: 'https://restcountries.eu/data/ind.svg',
840 | currency: 'Indian rupee'
841 | },
842 | {
843 | name: 'Indonesia',
844 | capital: 'Jakarta',
845 | languages: ['Indonesian'],
846 | population: 258705000,
847 | flag: 'https://restcountries.eu/data/idn.svg',
848 | currency: 'Indonesian rupiah'
849 | },
850 | {
851 | name: "Côte d'Ivoire",
852 | capital: 'Yamoussoukro',
853 | languages: ['French'],
854 | population: 22671331,
855 | flag: 'https://restcountries.eu/data/civ.svg',
856 | currency: 'West African CFA franc'
857 | },
858 | {
859 | name: 'Iran (Islamic Republic of)',
860 | capital: 'Tehran',
861 | languages: ['Persian (Farsi)'],
862 | population: 79369900,
863 | flag: 'https://restcountries.eu/data/irn.svg',
864 | currency: 'Iranian rial'
865 | },
866 | {
867 | name: 'Iraq',
868 | capital: 'Baghdad',
869 | languages: ['Arabic', 'Kurdish'],
870 | population: 37883543,
871 | flag: 'https://restcountries.eu/data/irq.svg',
872 | currency: 'Iraqi dinar'
873 | },
874 | {
875 | name: 'Ireland',
876 | capital: 'Dublin',
877 | languages: ['Irish', 'English'],
878 | population: 6378000,
879 | flag: 'https://restcountries.eu/data/irl.svg',
880 | currency: 'Euro'
881 | },
882 | {
883 | name: 'Isle of Man',
884 | capital: 'Douglas',
885 | languages: ['English', 'Manx'],
886 | population: 84497,
887 | flag: 'https://restcountries.eu/data/imn.svg',
888 | currency: 'British pound'
889 | },
890 | {
891 | name: 'Israel',
892 | capital: 'Jerusalem',
893 | languages: ['Hebrew (modern)', 'Arabic'],
894 | population: 8527400,
895 | flag: 'https://restcountries.eu/data/isr.svg',
896 | currency: 'Israeli new shekel'
897 | },
898 | {
899 | name: 'Italy',
900 | capital: 'Rome',
901 | languages: ['Italian'],
902 | population: 60665551,
903 | flag: 'https://restcountries.eu/data/ita.svg',
904 | currency: 'Euro'
905 | },
906 | {
907 | name: 'Jamaica',
908 | capital: 'Kingston',
909 | languages: ['English'],
910 | population: 2723246,
911 | flag: 'https://restcountries.eu/data/jam.svg',
912 | currency: 'Jamaican dollar'
913 | },
914 | {
915 | name: 'Japan',
916 | capital: 'Tokyo',
917 | languages: ['Japanese'],
918 | population: 126960000,
919 | flag: 'https://restcountries.eu/data/jpn.svg',
920 | currency: 'Japanese yen'
921 | },
922 | {
923 | name: 'Jersey',
924 | capital: 'Saint Helier',
925 | languages: ['English', 'French'],
926 | population: 100800,
927 | flag: 'https://restcountries.eu/data/jey.svg',
928 | currency: 'British pound'
929 | },
930 | {
931 | name: 'Jordan',
932 | capital: 'Amman',
933 | languages: ['Arabic'],
934 | population: 9531712,
935 | flag: 'https://restcountries.eu/data/jor.svg',
936 | currency: 'Jordanian dinar'
937 | },
938 | {
939 | name: 'Kazakhstan',
940 | capital: 'Astana',
941 | languages: ['Kazakh', 'Russian'],
942 | population: 17753200,
943 | flag: 'https://restcountries.eu/data/kaz.svg',
944 | currency: 'Kazakhstani tenge'
945 | },
946 | {
947 | name: 'Kenya',
948 | capital: 'Nairobi',
949 | languages: ['English', 'Swahili'],
950 | population: 47251000,
951 | flag: 'https://restcountries.eu/data/ken.svg',
952 | currency: 'Kenyan shilling'
953 | },
954 | {
955 | name: 'Kiribati',
956 | capital: 'South Tarawa',
957 | languages: ['English'],
958 | population: 113400,
959 | flag: 'https://restcountries.eu/data/kir.svg',
960 | currency: 'Australian dollar'
961 | },
962 | {
963 | name: 'Kuwait',
964 | capital: 'Kuwait City',
965 | languages: ['Arabic'],
966 | population: 4183658,
967 | flag: 'https://restcountries.eu/data/kwt.svg',
968 | currency: 'Kuwaiti dinar'
969 | },
970 | {
971 | name: 'Kyrgyzstan',
972 | capital: 'Bishkek',
973 | languages: ['Kyrgyz', 'Russian'],
974 | population: 6047800,
975 | flag: 'https://restcountries.eu/data/kgz.svg',
976 | currency: 'Kyrgyzstani som'
977 | },
978 | {
979 | name: "Lao People's Democratic Republic",
980 | capital: 'Vientiane',
981 | languages: ['Lao'],
982 | population: 6492400,
983 | flag: 'https://restcountries.eu/data/lao.svg',
984 | currency: 'Lao kip'
985 | },
986 | {
987 | name: 'Latvia',
988 | capital: 'Riga',
989 | languages: ['Latvian'],
990 | population: 1961600,
991 | flag: 'https://restcountries.eu/data/lva.svg',
992 | currency: 'Euro'
993 | },
994 | {
995 | name: 'Lebanon',
996 | capital: 'Beirut',
997 | languages: ['Arabic', 'French'],
998 | population: 5988000,
999 | flag: 'https://restcountries.eu/data/lbn.svg',
1000 | currency: 'Lebanese pound'
1001 | },
1002 | {
1003 | name: 'Lesotho',
1004 | capital: 'Maseru',
1005 | languages: ['English', 'Southern Sotho'],
1006 | population: 1894194,
1007 | flag: 'https://restcountries.eu/data/lso.svg',
1008 | currency: 'Lesotho loti'
1009 | },
1010 | {
1011 | name: 'Liberia',
1012 | capital: 'Monrovia',
1013 | languages: ['English'],
1014 | population: 4615000,
1015 | flag: 'https://restcountries.eu/data/lbr.svg',
1016 | currency: 'Liberian dollar'
1017 | },
1018 | {
1019 | name: 'Libya',
1020 | capital: 'Tripoli',
1021 | languages: ['Arabic'],
1022 | population: 6385000,
1023 | flag: 'https://restcountries.eu/data/lby.svg',
1024 | currency: 'Libyan dinar'
1025 | },
1026 | {
1027 | name: 'Liechtenstein',
1028 | capital: 'Vaduz',
1029 | languages: ['German'],
1030 | population: 37623,
1031 | flag: 'https://restcountries.eu/data/lie.svg',
1032 | currency: 'Swiss franc'
1033 | },
1034 | {
1035 | name: 'Lithuania',
1036 | capital: 'Vilnius',
1037 | languages: ['Lithuanian'],
1038 | population: 2872294,
1039 | flag: 'https://restcountries.eu/data/ltu.svg',
1040 | currency: 'Euro'
1041 | },
1042 | {
1043 | name: 'Luxembourg',
1044 | capital: 'Luxembourg',
1045 | languages: ['French', 'German', 'Luxembourgish'],
1046 | population: 576200,
1047 | flag: 'https://restcountries.eu/data/lux.svg',
1048 | currency: 'Euro'
1049 | },
1050 | {
1051 | name: 'Macao',
1052 | capital: '',
1053 | languages: ['Chinese', 'Portuguese'],
1054 | population: 649100,
1055 | flag: 'https://restcountries.eu/data/mac.svg',
1056 | currency: 'Macanese pataca'
1057 | },
1058 | {
1059 | name: 'Macedonia (the former Yugoslav Republic of)',
1060 | capital: 'Skopje',
1061 | languages: ['Macedonian'],
1062 | population: 2058539,
1063 | flag: 'https://restcountries.eu/data/mkd.svg',
1064 | currency: 'Macedonian denar'
1065 | },
1066 | {
1067 | name: 'Madagascar',
1068 | capital: 'Antananarivo',
1069 | languages: ['French', 'Malagasy'],
1070 | population: 22434363,
1071 | flag: 'https://restcountries.eu/data/mdg.svg',
1072 | currency: 'Malagasy ariary'
1073 | },
1074 | {
1075 | name: 'Malawi',
1076 | capital: 'Lilongwe',
1077 | languages: ['English', 'Chichewa'],
1078 | population: 16832910,
1079 | flag: 'https://restcountries.eu/data/mwi.svg',
1080 | currency: 'Malawian kwacha'
1081 | },
1082 | {
1083 | name: 'Malaysia',
1084 | capital: 'Kuala Lumpur',
1085 | languages: ['Malaysian'],
1086 | population: 31405416,
1087 | flag: 'https://restcountries.eu/data/mys.svg',
1088 | currency: 'Malaysian ringgit'
1089 | },
1090 | {
1091 | name: 'Maldives',
1092 | capital: 'Malé',
1093 | languages: ['Divehi'],
1094 | population: 344023,
1095 | flag: 'https://restcountries.eu/data/mdv.svg',
1096 | currency: 'Maldivian rufiyaa'
1097 | },
1098 | {
1099 | name: 'Mali',
1100 | capital: 'Bamako',
1101 | languages: ['French'],
1102 | population: 18135000,
1103 | flag: 'https://restcountries.eu/data/mli.svg',
1104 | currency: 'West African CFA franc'
1105 | },
1106 | {
1107 | name: 'Malta',
1108 | capital: 'Valletta',
1109 | languages: ['Maltese', 'English'],
1110 | population: 425384,
1111 | flag: 'https://restcountries.eu/data/mlt.svg',
1112 | currency: 'Euro'
1113 | },
1114 | {
1115 | name: 'Marshall Islands',
1116 | capital: 'Majuro',
1117 | languages: ['English', 'Marshallese'],
1118 | population: 54880,
1119 | flag: 'https://restcountries.eu/data/mhl.svg',
1120 | currency: 'United States dollar'
1121 | },
1122 | {
1123 | name: 'Martinique',
1124 | capital: 'Fort-de-France',
1125 | languages: ['French'],
1126 | population: 378243,
1127 | flag: 'https://restcountries.eu/data/mtq.svg',
1128 | currency: 'Euro'
1129 | },
1130 | {
1131 | name: 'Mauritania',
1132 | capital: 'Nouakchott',
1133 | languages: ['Arabic'],
1134 | population: 3718678,
1135 | flag: 'https://restcountries.eu/data/mrt.svg',
1136 | currency: 'Mauritanian ouguiya'
1137 | },
1138 | {
1139 | name: 'Mauritius',
1140 | capital: 'Port Louis',
1141 | languages: ['English'],
1142 | population: 1262879,
1143 | flag: 'https://restcountries.eu/data/mus.svg',
1144 | currency: 'Mauritian rupee'
1145 | },
1146 | {
1147 | name: 'Mayotte',
1148 | capital: 'Mamoudzou',
1149 | languages: ['French'],
1150 | population: 226915,
1151 | flag: 'https://restcountries.eu/data/myt.svg',
1152 | currency: 'Euro'
1153 | },
1154 | {
1155 | name: 'Mexico',
1156 | capital: 'Mexico City',
1157 | languages: ['Spanish'],
1158 | population: 122273473,
1159 | flag: 'https://restcountries.eu/data/mex.svg',
1160 | currency: 'Mexican peso'
1161 | },
1162 | {
1163 | name: 'Micronesia (Federated States of)',
1164 | capital: 'Palikir',
1165 | languages: ['English'],
1166 | population: 102800,
1167 | flag: 'https://restcountries.eu/data/fsm.svg',
1168 | currency: '[D]'
1169 | },
1170 | {
1171 | name: 'Moldova (Republic of)',
1172 | capital: 'Chișinău',
1173 | languages: ['Romanian'],
1174 | population: 3553100,
1175 | flag: 'https://restcountries.eu/data/mda.svg',
1176 | currency: 'Moldovan leu'
1177 | },
1178 | {
1179 | name: 'Monaco',
1180 | capital: 'Monaco',
1181 | languages: ['French'],
1182 | population: 38400,
1183 | flag: 'https://restcountries.eu/data/mco.svg',
1184 | currency: 'Euro'
1185 | },
1186 | {
1187 | name: 'Mongolia',
1188 | capital: 'Ulan Bator',
1189 | languages: ['Mongolian'],
1190 | population: 3093100,
1191 | flag: 'https://restcountries.eu/data/mng.svg',
1192 | currency: 'Mongolian tögrög'
1193 | },
1194 | {
1195 | name: 'Montenegro',
1196 | capital: 'Podgorica',
1197 | languages: ['Serbian', 'Bosnian', 'Albanian', 'Croatian'],
1198 | population: 621810,
1199 | flag: 'https://restcountries.eu/data/mne.svg',
1200 | currency: 'Euro'
1201 | },
1202 | {
1203 | name: 'Montserrat',
1204 | capital: 'Plymouth',
1205 | languages: ['English'],
1206 | population: 4922,
1207 | flag: 'https://restcountries.eu/data/msr.svg',
1208 | currency: 'East Caribbean dollar'
1209 | },
1210 | {
1211 | name: 'Morocco',
1212 | capital: 'Rabat',
1213 | languages: ['Arabic'],
1214 | population: 33337529,
1215 | flag: 'https://restcountries.eu/data/mar.svg',
1216 | currency: 'Moroccan dirham'
1217 | },
1218 | {
1219 | name: 'Mozambique',
1220 | capital: 'Maputo',
1221 | languages: ['Portuguese'],
1222 | population: 26423700,
1223 | flag: 'https://restcountries.eu/data/moz.svg',
1224 | currency: 'Mozambican metical'
1225 | },
1226 | {
1227 | name: 'Myanmar',
1228 | capital: 'Naypyidaw',
1229 | languages: ['Burmese'],
1230 | population: 51419420,
1231 | flag: 'https://restcountries.eu/data/mmr.svg',
1232 | currency: 'Burmese kyat'
1233 | },
1234 | {
1235 | name: 'Namibia',
1236 | capital: 'Windhoek',
1237 | languages: ['English', 'Afrikaans'],
1238 | population: 2324388,
1239 | flag: 'https://restcountries.eu/data/nam.svg',
1240 | currency: 'Namibian dollar'
1241 | },
1242 | {
1243 | name: 'Nauru',
1244 | capital: 'Yaren',
1245 | languages: ['English', 'Nauruan'],
1246 | population: 10084,
1247 | flag: 'https://restcountries.eu/data/nru.svg',
1248 | currency: 'Australian dollar'
1249 | },
1250 | {
1251 | name: 'Nepal',
1252 | capital: 'Kathmandu',
1253 | languages: ['Nepali'],
1254 | population: 28431500,
1255 | flag: 'https://restcountries.eu/data/npl.svg',
1256 | currency: 'Nepalese rupee'
1257 | },
1258 | {
1259 | name: 'Netherlands',
1260 | capital: 'Amsterdam',
1261 | languages: ['Dutch'],
1262 | population: 17019800,
1263 | flag: 'https://restcountries.eu/data/nld.svg',
1264 | currency: 'Euro'
1265 | },
1266 | {
1267 | name: 'New Caledonia',
1268 | capital: 'Nouméa',
1269 | languages: ['French'],
1270 | population: 268767,
1271 | flag: 'https://restcountries.eu/data/ncl.svg',
1272 | currency: 'CFP franc'
1273 | },
1274 | {
1275 | name: 'New Zealand',
1276 | capital: 'Wellington',
1277 | languages: ['English', 'Māori'],
1278 | population: 4697854,
1279 | flag: 'https://restcountries.eu/data/nzl.svg',
1280 | currency: 'New Zealand dollar'
1281 | },
1282 | {
1283 | name: 'Nicaragua',
1284 | capital: 'Managua',
1285 | languages: ['Spanish'],
1286 | population: 6262703,
1287 | flag: 'https://restcountries.eu/data/nic.svg',
1288 | currency: 'Nicaraguan córdoba'
1289 | },
1290 | {
1291 | name: 'Niger',
1292 | capital: 'Niamey',
1293 | languages: ['French'],
1294 | population: 20715000,
1295 | flag: 'https://restcountries.eu/data/ner.svg',
1296 | currency: 'West African CFA franc'
1297 | },
1298 | {
1299 | name: 'Nigeria',
1300 | capital: 'Abuja',
1301 | languages: ['English'],
1302 | population: 186988000,
1303 | flag: 'https://restcountries.eu/data/nga.svg',
1304 | currency: 'Nigerian naira'
1305 | },
1306 | {
1307 | name: 'Niue',
1308 | capital: 'Alofi',
1309 | languages: ['English'],
1310 | population: 1470,
1311 | flag: 'https://restcountries.eu/data/niu.svg',
1312 | currency: 'New Zealand dollar'
1313 | },
1314 | {
1315 | name: 'Norfolk Island',
1316 | capital: 'Kingston',
1317 | languages: ['English'],
1318 | population: 2302,
1319 | flag: 'https://restcountries.eu/data/nfk.svg',
1320 | currency: 'Australian dollar'
1321 | },
1322 | {
1323 | name: "Korea (Democratic People's Republic of)",
1324 | capital: 'Pyongyang',
1325 | languages: ['Korean'],
1326 | population: 25281000,
1327 | flag: 'https://restcountries.eu/data/prk.svg',
1328 | currency: 'North Korean won'
1329 | },
1330 | {
1331 | name: 'Northern Mariana Islands',
1332 | capital: 'Saipan',
1333 | languages: ['English', 'Chamorro'],
1334 | population: 56940,
1335 | flag: 'https://restcountries.eu/data/mnp.svg',
1336 | currency: 'United States dollar'
1337 | },
1338 | {
1339 | name: 'Norway',
1340 | capital: 'Oslo',
1341 | languages: ['Norwegian', 'Norwegian Bokmål', 'Norwegian Nynorsk'],
1342 | population: 5223256,
1343 | flag: 'https://restcountries.eu/data/nor.svg',
1344 | currency: 'Norwegian krone'
1345 | },
1346 | {
1347 | name: 'Oman',
1348 | capital: 'Muscat',
1349 | languages: ['Arabic'],
1350 | population: 4420133,
1351 | flag: 'https://restcountries.eu/data/omn.svg',
1352 | currency: 'Omani rial'
1353 | },
1354 | {
1355 | name: 'Pakistan',
1356 | capital: 'Islamabad',
1357 | languages: ['English', 'Urdu'],
1358 | population: 194125062,
1359 | flag: 'https://restcountries.eu/data/pak.svg',
1360 | currency: 'Pakistani rupee'
1361 | },
1362 | {
1363 | name: 'Palau',
1364 | capital: 'Ngerulmud',
1365 | languages: ['English'],
1366 | population: 17950,
1367 | flag: 'https://restcountries.eu/data/plw.svg',
1368 | currency: '[E]'
1369 | },
1370 | {
1371 | name: 'Palestine, State of',
1372 | capital: 'Ramallah',
1373 | languages: ['Arabic'],
1374 | population: 4682467,
1375 | flag: 'https://restcountries.eu/data/pse.svg',
1376 | currency: 'Israeli new sheqel'
1377 | },
1378 | {
1379 | name: 'Panama',
1380 | capital: 'Panama City',
1381 | languages: ['Spanish'],
1382 | population: 3814672,
1383 | flag: 'https://restcountries.eu/data/pan.svg',
1384 | currency: 'Panamanian balboa'
1385 | },
1386 | {
1387 | name: 'Papua New Guinea',
1388 | capital: 'Port Moresby',
1389 | languages: ['English'],
1390 | population: 8083700,
1391 | flag: 'https://restcountries.eu/data/png.svg',
1392 | currency: 'Papua New Guinean kina'
1393 | },
1394 | {
1395 | name: 'Paraguay',
1396 | capital: 'Asunción',
1397 | languages: ['Spanish', 'Guaraní'],
1398 | population: 6854536,
1399 | flag: 'https://restcountries.eu/data/pry.svg',
1400 | currency: 'Paraguayan guaraní'
1401 | },
1402 | {
1403 | name: 'Peru',
1404 | capital: 'Lima',
1405 | languages: ['Spanish'],
1406 | population: 31488700,
1407 | flag: 'https://restcountries.eu/data/per.svg',
1408 | currency: 'Peruvian sol'
1409 | },
1410 | {
1411 | name: 'Philippines',
1412 | capital: 'Manila',
1413 | languages: ['English'],
1414 | population: 103279800,
1415 | flag: 'https://restcountries.eu/data/phl.svg',
1416 | currency: 'Philippine peso'
1417 | },
1418 | {
1419 | name: 'Pitcairn',
1420 | capital: 'Adamstown',
1421 | languages: ['English'],
1422 | population: 56,
1423 | flag: 'https://restcountries.eu/data/pcn.svg',
1424 | currency: 'New Zealand dollar'
1425 | },
1426 | {
1427 | name: 'Poland',
1428 | capital: 'Warsaw',
1429 | languages: ['Polish'],
1430 | population: 38437239,
1431 | flag: 'https://restcountries.eu/data/pol.svg',
1432 | currency: 'Polish złoty'
1433 | },
1434 | {
1435 | name: 'Portugal',
1436 | capital: 'Lisbon',
1437 | languages: ['Portuguese'],
1438 | population: 10374822,
1439 | flag: 'https://restcountries.eu/data/prt.svg',
1440 | currency: 'Euro'
1441 | },
1442 | {
1443 | name: 'Puerto Rico',
1444 | capital: 'San Juan',
1445 | languages: ['Spanish', 'English'],
1446 | population: 3474182,
1447 | flag: 'https://restcountries.eu/data/pri.svg',
1448 | currency: 'United States dollar'
1449 | },
1450 | {
1451 | name: 'Qatar',
1452 | capital: 'Doha',
1453 | languages: ['Arabic'],
1454 | population: 2587564,
1455 | flag: 'https://restcountries.eu/data/qat.svg',
1456 | currency: 'Qatari riyal'
1457 | },
1458 | {
1459 | name: 'Republic of Kosovo',
1460 | capital: 'Pristina',
1461 | languages: ['Albanian', 'Serbian'],
1462 | population: 1733842,
1463 | flag: 'https://restcountries.eu/data/kos.svg',
1464 | currency: 'Euro'
1465 | },
1466 | {
1467 | name: 'Réunion',
1468 | capital: 'Saint-Denis',
1469 | languages: ['French'],
1470 | population: 840974,
1471 | flag: 'https://restcountries.eu/data/reu.svg',
1472 | currency: 'Euro'
1473 | },
1474 | {
1475 | name: 'Romania',
1476 | capital: 'Bucharest',
1477 | languages: ['Romanian'],
1478 | population: 19861408,
1479 | flag: 'https://restcountries.eu/data/rou.svg',
1480 | currency: 'Romanian leu'
1481 | },
1482 | {
1483 | name: 'Russian Federation',
1484 | capital: 'Moscow',
1485 | languages: ['Russian'],
1486 | population: 146599183,
1487 | flag: 'https://restcountries.eu/data/rus.svg',
1488 | currency: 'Russian ruble'
1489 | },
1490 | {
1491 | name: 'Rwanda',
1492 | capital: 'Kigali',
1493 | languages: ['Kinyarwanda', 'English', 'French'],
1494 | population: 11553188,
1495 | flag: 'https://restcountries.eu/data/rwa.svg',
1496 | currency: 'Rwandan franc'
1497 | },
1498 | {
1499 | name: 'Saint Barthélemy',
1500 | capital: 'Gustavia',
1501 | languages: ['French'],
1502 | population: 9417,
1503 | flag: 'https://restcountries.eu/data/blm.svg',
1504 | currency: 'Euro'
1505 | },
1506 | {
1507 | name: 'Saint Helena, Ascension and Tristan da Cunha',
1508 | capital: 'Jamestown',
1509 | languages: ['English'],
1510 | population: 4255,
1511 | flag: 'https://restcountries.eu/data/shn.svg',
1512 | currency: 'Saint Helena pound'
1513 | },
1514 | {
1515 | name: 'Saint Kitts and Nevis',
1516 | capital: 'Basseterre',
1517 | languages: ['English'],
1518 | population: 46204,
1519 | flag: 'https://restcountries.eu/data/kna.svg',
1520 | currency: 'East Caribbean dollar'
1521 | },
1522 | {
1523 | name: 'Saint Lucia',
1524 | capital: 'Castries',
1525 | languages: ['English'],
1526 | population: 186000,
1527 | flag: 'https://restcountries.eu/data/lca.svg',
1528 | currency: 'East Caribbean dollar'
1529 | },
1530 | {
1531 | name: 'Saint Martin (French part)',
1532 | capital: 'Marigot',
1533 | languages: ['English', 'French', 'Dutch'],
1534 | population: 36979,
1535 | flag: 'https://restcountries.eu/data/maf.svg',
1536 | currency: 'Euro'
1537 | },
1538 | {
1539 | name: 'Saint Pierre and Miquelon',
1540 | capital: 'Saint-Pierre',
1541 | languages: ['French'],
1542 | population: 6069,
1543 | flag: 'https://restcountries.eu/data/spm.svg',
1544 | currency: 'Euro'
1545 | },
1546 | {
1547 | name: 'Saint Vincent and the Grenadines',
1548 | capital: 'Kingstown',
1549 | languages: ['English'],
1550 | population: 109991,
1551 | flag: 'https://restcountries.eu/data/vct.svg',
1552 | currency: 'East Caribbean dollar'
1553 | },
1554 | {
1555 | name: 'Samoa',
1556 | capital: 'Apia',
1557 | languages: ['Samoan', 'English'],
1558 | population: 194899,
1559 | flag: 'https://restcountries.eu/data/wsm.svg',
1560 | currency: 'Samoan tālā'
1561 | },
1562 | {
1563 | name: 'San Marino',
1564 | capital: 'City of San Marino',
1565 | languages: ['Italian'],
1566 | population: 33005,
1567 | flag: 'https://restcountries.eu/data/smr.svg',
1568 | currency: 'Euro'
1569 | },
1570 | {
1571 | name: 'Sao Tome and Principe',
1572 | capital: 'São Tomé',
1573 | languages: ['Portuguese'],
1574 | population: 187356,
1575 | flag: 'https://restcountries.eu/data/stp.svg',
1576 | currency: 'São Tomé and Príncipe dobra'
1577 | },
1578 | {
1579 | name: 'Saudi Arabia',
1580 | capital: 'Riyadh',
1581 | languages: ['Arabic'],
1582 | population: 32248200,
1583 | flag: 'https://restcountries.eu/data/sau.svg',
1584 | currency: 'Saudi riyal'
1585 | },
1586 | {
1587 | name: 'Senegal',
1588 | capital: 'Dakar',
1589 | languages: ['French'],
1590 | population: 14799859,
1591 | flag: 'https://restcountries.eu/data/sen.svg',
1592 | currency: 'West African CFA franc'
1593 | },
1594 | {
1595 | name: 'Serbia',
1596 | capital: 'Belgrade',
1597 | languages: ['Serbian'],
1598 | population: 7076372,
1599 | flag: 'https://restcountries.eu/data/srb.svg',
1600 | currency: 'Serbian dinar'
1601 | },
1602 | {
1603 | name: 'Seychelles',
1604 | capital: 'Victoria',
1605 | languages: ['French', 'English'],
1606 | population: 91400,
1607 | flag: 'https://restcountries.eu/data/syc.svg',
1608 | currency: 'Seychellois rupee'
1609 | },
1610 | {
1611 | name: 'Sierra Leone',
1612 | capital: 'Freetown',
1613 | languages: ['English'],
1614 | population: 7075641,
1615 | flag: 'https://restcountries.eu/data/sle.svg',
1616 | currency: 'Sierra Leonean leone'
1617 | },
1618 | {
1619 | name: 'Singapore',
1620 | capital: 'Singapore',
1621 | languages: ['English', 'Malay', 'Tamil', 'Chinese'],
1622 | population: 5535000,
1623 | flag: 'https://restcountries.eu/data/sgp.svg',
1624 | currency: 'Brunei dollar'
1625 | },
1626 | {
1627 | name: 'Sint Maarten (Dutch part)',
1628 | capital: 'Philipsburg',
1629 | languages: ['Dutch', 'English'],
1630 | population: 38247,
1631 | flag: 'https://restcountries.eu/data/sxm.svg',
1632 | currency: 'Netherlands Antillean guilder'
1633 | },
1634 | {
1635 | name: 'Slovakia',
1636 | capital: 'Bratislava',
1637 | languages: ['Slovak'],
1638 | population: 5426252,
1639 | flag: 'https://restcountries.eu/data/svk.svg',
1640 | currency: 'Euro'
1641 | },
1642 | {
1643 | name: 'Slovenia',
1644 | capital: 'Ljubljana',
1645 | languages: ['Slovene'],
1646 | population: 2064188,
1647 | flag: 'https://restcountries.eu/data/svn.svg',
1648 | currency: 'Euro'
1649 | },
1650 | {
1651 | name: 'Solomon Islands',
1652 | capital: 'Honiara',
1653 | languages: ['English'],
1654 | population: 642000,
1655 | flag: 'https://restcountries.eu/data/slb.svg',
1656 | currency: 'Solomon Islands dollar'
1657 | },
1658 | {
1659 | name: 'Somalia',
1660 | capital: 'Mogadishu',
1661 | languages: ['Somali', 'Arabic'],
1662 | population: 11079000,
1663 | flag: 'https://restcountries.eu/data/som.svg',
1664 | currency: 'Somali shilling'
1665 | },
1666 | {
1667 | name: 'South Africa',
1668 | capital: 'Pretoria',
1669 | languages: [
1670 | 'Afrikaans',
1671 | 'English',
1672 | 'Southern Ndebele',
1673 | 'Southern Sotho',
1674 | 'Swati',
1675 | 'Tswana',
1676 | 'Tsonga',
1677 | 'Venda',
1678 | 'Xhosa',
1679 | 'Zulu'
1680 | ],
1681 | population: 55653654,
1682 | flag: 'https://restcountries.eu/data/zaf.svg',
1683 | currency: 'South African rand'
1684 | },
1685 | {
1686 | name: 'South Georgia and the South Sandwich Islands',
1687 | capital: 'King Edward Point',
1688 | languages: ['English'],
1689 | population: 30,
1690 | flag: 'https://restcountries.eu/data/sgs.svg',
1691 | currency: 'British pound'
1692 | },
1693 | {
1694 | name: 'Korea (Republic of)',
1695 | capital: 'Seoul',
1696 | languages: ['Korean'],
1697 | population: 50801405,
1698 | flag: 'https://restcountries.eu/data/kor.svg',
1699 | currency: 'South Korean won'
1700 | },
1701 | {
1702 | name: 'South Sudan',
1703 | capital: 'Juba',
1704 | languages: ['English'],
1705 | population: 12131000,
1706 | flag: 'https://restcountries.eu/data/ssd.svg',
1707 | currency: 'South Sudanese pound'
1708 | },
1709 | {
1710 | name: 'Spain',
1711 | capital: 'Madrid',
1712 | languages: ['Spanish'],
1713 | population: 46438422,
1714 | flag: 'https://restcountries.eu/data/esp.svg',
1715 | currency: 'Euro'
1716 | },
1717 | {
1718 | name: 'Sri Lanka',
1719 | capital: 'Colombo',
1720 | languages: ['Sinhalese', 'Tamil'],
1721 | population: 20966000,
1722 | flag: 'https://restcountries.eu/data/lka.svg',
1723 | currency: 'Sri Lankan rupee'
1724 | },
1725 | {
1726 | name: 'Sudan',
1727 | capital: 'Khartoum',
1728 | languages: ['Arabic', 'English'],
1729 | population: 39598700,
1730 | flag: 'https://restcountries.eu/data/sdn.svg',
1731 | currency: 'Sudanese pound'
1732 | },
1733 | {
1734 | name: 'Suriname',
1735 | capital: 'Paramaribo',
1736 | languages: ['Dutch'],
1737 | population: 541638,
1738 | flag: 'https://restcountries.eu/data/sur.svg',
1739 | currency: 'Surinamese dollar'
1740 | },
1741 | {
1742 | name: 'Svalbard and Jan Mayen',
1743 | capital: 'Longyearbyen',
1744 | languages: ['Norwegian'],
1745 | population: 2562,
1746 | flag: 'https://restcountries.eu/data/sjm.svg',
1747 | currency: 'Norwegian krone'
1748 | },
1749 | {
1750 | name: 'Swaziland',
1751 | capital: 'Lobamba',
1752 | languages: ['English', 'Swati'],
1753 | population: 1132657,
1754 | flag: 'https://restcountries.eu/data/swz.svg',
1755 | currency: 'Swazi lilangeni'
1756 | },
1757 | {
1758 | name: 'Sweden',
1759 | capital: 'Stockholm',
1760 | languages: ['Swedish'],
1761 | population: 9894888,
1762 | flag: 'https://restcountries.eu/data/swe.svg',
1763 | currency: 'Swedish krona'
1764 | },
1765 | {
1766 | name: 'Switzerland',
1767 | capital: 'Bern',
1768 | languages: ['German', 'French', 'Italian'],
1769 | population: 8341600,
1770 | flag: 'https://restcountries.eu/data/che.svg',
1771 | currency: 'Swiss franc'
1772 | },
1773 | {
1774 | name: 'Syrian Arab Republic',
1775 | capital: 'Damascus',
1776 | languages: ['Arabic'],
1777 | population: 18564000,
1778 | flag: 'https://restcountries.eu/data/syr.svg',
1779 | currency: 'Syrian pound'
1780 | },
1781 | {
1782 | name: 'Taiwan',
1783 | capital: 'Taipei',
1784 | languages: ['Chinese'],
1785 | population: 23503349,
1786 | flag: 'https://restcountries.eu/data/twn.svg',
1787 | currency: 'New Taiwan dollar'
1788 | },
1789 | {
1790 | name: 'Tajikistan',
1791 | capital: 'Dushanbe',
1792 | languages: ['Tajik', 'Russian'],
1793 | population: 8593600,
1794 | flag: 'https://restcountries.eu/data/tjk.svg',
1795 | currency: 'Tajikistani somoni'
1796 | },
1797 | {
1798 | name: 'Tanzania, United Republic of',
1799 | capital: 'Dodoma',
1800 | languages: ['Swahili', 'English'],
1801 | population: 55155000,
1802 | flag: 'https://restcountries.eu/data/tza.svg',
1803 | currency: 'Tanzanian shilling'
1804 | },
1805 | {
1806 | name: 'Thailand',
1807 | capital: 'Bangkok',
1808 | languages: ['Thai'],
1809 | population: 65327652,
1810 | flag: 'https://restcountries.eu/data/tha.svg',
1811 | currency: 'Thai baht'
1812 | },
1813 | {
1814 | name: 'Timor-Leste',
1815 | capital: 'Dili',
1816 | languages: ['Portuguese'],
1817 | population: 1167242,
1818 | flag: 'https://restcountries.eu/data/tls.svg',
1819 | currency: 'United States dollar'
1820 | },
1821 | {
1822 | name: 'Togo',
1823 | capital: 'Lomé',
1824 | languages: ['French'],
1825 | population: 7143000,
1826 | flag: 'https://restcountries.eu/data/tgo.svg',
1827 | currency: 'West African CFA franc'
1828 | },
1829 | {
1830 | name: 'Tokelau',
1831 | capital: 'Fakaofo',
1832 | languages: ['English'],
1833 | population: 1411,
1834 | flag: 'https://restcountries.eu/data/tkl.svg',
1835 | currency: 'New Zealand dollar'
1836 | },
1837 | {
1838 | name: 'Tonga',
1839 | capital: "Nuku'alofa",
1840 | languages: ['English', 'Tonga (Tonga Islands)'],
1841 | population: 103252,
1842 | flag: 'https://restcountries.eu/data/ton.svg',
1843 | currency: 'Tongan paʻanga'
1844 | },
1845 | {
1846 | name: 'Trinidad and Tobago',
1847 | capital: 'Port of Spain',
1848 | languages: ['English'],
1849 | population: 1349667,
1850 | flag: 'https://restcountries.eu/data/tto.svg',
1851 | currency: 'Trinidad and Tobago dollar'
1852 | },
1853 | {
1854 | name: 'Tunisia',
1855 | capital: 'Tunis',
1856 | languages: ['Arabic'],
1857 | population: 11154400,
1858 | flag: 'https://restcountries.eu/data/tun.svg',
1859 | currency: 'Tunisian dinar'
1860 | },
1861 | {
1862 | name: 'Turkey',
1863 | capital: 'Ankara',
1864 | languages: ['Turkish'],
1865 | population: 78741053,
1866 | flag: 'https://restcountries.eu/data/tur.svg',
1867 | currency: 'Turkish lira'
1868 | },
1869 | {
1870 | name: 'Turkmenistan',
1871 | capital: 'Ashgabat',
1872 | languages: ['Turkmen', 'Russian'],
1873 | population: 4751120,
1874 | flag: 'https://restcountries.eu/data/tkm.svg',
1875 | currency: 'Turkmenistan manat'
1876 | },
1877 | {
1878 | name: 'Turks and Caicos Islands',
1879 | capital: 'Cockburn Town',
1880 | languages: ['English'],
1881 | population: 31458,
1882 | flag: 'https://restcountries.eu/data/tca.svg',
1883 | currency: 'United States dollar'
1884 | },
1885 | {
1886 | name: 'Tuvalu',
1887 | capital: 'Funafuti',
1888 | languages: ['English'],
1889 | population: 10640,
1890 | flag: 'https://restcountries.eu/data/tuv.svg',
1891 | currency: 'Australian dollar'
1892 | },
1893 | {
1894 | name: 'Uganda',
1895 | capital: 'Kampala',
1896 | languages: ['English', 'Swahili'],
1897 | population: 33860700,
1898 | flag: 'https://restcountries.eu/data/uga.svg',
1899 | currency: 'Ugandan shilling'
1900 | },
1901 | {
1902 | name: 'Ukraine',
1903 | capital: 'Kiev',
1904 | languages: ['Ukrainian'],
1905 | population: 42692393,
1906 | flag: 'https://restcountries.eu/data/ukr.svg',
1907 | currency: 'Ukrainian hryvnia'
1908 | },
1909 | {
1910 | name: 'United Arab Emirates',
1911 | capital: 'Abu Dhabi',
1912 | languages: ['Arabic'],
1913 | population: 9856000,
1914 | flag: 'https://restcountries.eu/data/are.svg',
1915 | currency: 'United Arab Emirates dirham'
1916 | },
1917 | {
1918 | name: 'United Kingdom of Great Britain and Northern Ireland',
1919 | capital: 'London',
1920 | languages: ['English'],
1921 | population: 65110000,
1922 | flag: 'https://restcountries.eu/data/gbr.svg',
1923 | currency: 'British pound'
1924 | },
1925 | {
1926 | name: 'United States of America',
1927 | capital: 'Washington, D.C.',
1928 | languages: ['English'],
1929 | population: 323947000,
1930 | flag: 'https://restcountries.eu/data/usa.svg',
1931 | currency: 'United States dollar'
1932 | },
1933 | {
1934 | name: 'Uruguay',
1935 | capital: 'Montevideo',
1936 | languages: ['Spanish'],
1937 | population: 3480222,
1938 | flag: 'https://restcountries.eu/data/ury.svg',
1939 | currency: 'Uruguayan peso'
1940 | },
1941 | {
1942 | name: 'Uzbekistan',
1943 | capital: 'Tashkent',
1944 | languages: ['Uzbek', 'Russian'],
1945 | population: 31576400,
1946 | flag: 'https://restcountries.eu/data/uzb.svg',
1947 | currency: "Uzbekistani so'm"
1948 | },
1949 | {
1950 | name: 'Vanuatu',
1951 | capital: 'Port Vila',
1952 | languages: ['Bislama', 'English', 'French'],
1953 | population: 277500,
1954 | flag: 'https://restcountries.eu/data/vut.svg',
1955 | currency: 'Vanuatu vatu'
1956 | },
1957 | {
1958 | name: 'Venezuela (Bolivarian Republic of)',
1959 | capital: 'Caracas',
1960 | languages: ['Spanish'],
1961 | population: 31028700,
1962 | flag: 'https://restcountries.eu/data/ven.svg',
1963 | currency: 'Venezuelan bolívar'
1964 | },
1965 | {
1966 | name: 'Viet Nam',
1967 | capital: 'Hanoi',
1968 | languages: ['Vietnamese'],
1969 | population: 92700000,
1970 | flag: 'https://restcountries.eu/data/vnm.svg',
1971 | currency: 'Vietnamese đồng'
1972 | },
1973 | {
1974 | name: 'Wallis and Futuna',
1975 | capital: 'Mata-Utu',
1976 | languages: ['French'],
1977 | population: 11750,
1978 | flag: 'https://restcountries.eu/data/wlf.svg',
1979 | currency: 'CFP franc'
1980 | },
1981 | {
1982 | name: 'Western Sahara',
1983 | capital: 'El Aaiún',
1984 | languages: ['Spanish'],
1985 | population: 510713,
1986 | flag: 'https://restcountries.eu/data/esh.svg',
1987 | currency: 'Moroccan dirham'
1988 | },
1989 | {
1990 | name: 'Yemen',
1991 | capital: "Sana'a",
1992 | languages: ['Arabic'],
1993 | population: 27478000,
1994 | flag: 'https://restcountries.eu/data/yem.svg',
1995 | currency: 'Yemeni rial'
1996 | },
1997 | {
1998 | name: 'Zambia',
1999 | capital: 'Lusaka',
2000 | languages: ['English'],
2001 | population: 15933883,
2002 | flag: 'https://restcountries.eu/data/zmb.svg',
2003 | currency: 'Zambian kwacha'
2004 | },
2005 | {
2006 | name: 'Zimbabwe',
2007 | capital: 'Harare',
2008 | languages: ['English', 'Shona', 'Northern Ndebele'],
2009 | population: 14240168,
2010 | flag: 'https://restcountries.eu/data/zwe.svg',
2011 | currency: 'Botswana pula'
2012 | }
2013 | ]
--------------------------------------------------------------------------------