|
17 | 17 |
|
18 | 18 | </div> |
19 | 19 |
|
20 | | -[<< Day 7](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/09_Day/09_day_function_programming.md) | [Day 9 >>](#) |
| 20 | +[<< Day 7](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/07_Day/07_day_functions.md) | [Day 9 >>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/07_Day/07_day_higher_order_function.md) |
21 | 21 |
|
22 | 22 |  |
23 | 23 |
|
24 | | -- [Day 8](#day-8) |
| 24 | +- [📔 Day 8](#%f0%9f%93%94-day-8) |
25 | 25 | - [Scope](#scope) |
26 | 26 | - [Window Scope](#window-scope) |
27 | 27 | - [Global scope](#global-scope) |
|
39 | 39 | - [Checking properties using hasOwnProperty()](#checking-properties-using-hasownproperty) |
40 | 40 | - [💻 Exercises](#%f0%9f%92%bb-exercises) |
41 | 41 |
|
42 | | -# Day 8 |
| 42 | +# 📔 Day 8 |
43 | 43 |
|
44 | 44 | ## Scope |
45 | 45 |
|
@@ -490,94 +490,8 @@ console.log(copyPerson.hasOwnProperty('score')) |
490 | 490 | 1. Get all keys or properties of users object |
491 | 491 | 1. Get all the values of users object |
492 | 492 | 1. Use the countries object to print a country name, capital, populations and languages. |
493 | | -1. \*\*\* Find the 10 most spoken languages: |
494 | 493 |
|
495 | | - ````js |
496 | | - // Your output should look like this |
497 | | - console.log(mostSpokenLanguages(countries, 10)) |
498 | | - [(91, 'English'), |
499 | | - (45, 'French'), |
500 | | - (25, 'Arabic'), |
501 | | - (24, 'Spanish'), |
502 | | - (9, 'Russian'), |
503 | | - (9, 'Portuguese'), |
504 | | - (8, 'Dutch'), |
505 | | - (7, 'German'), |
506 | | - (5, 'Chinese'), |
507 | | - (4, 'Swahili'), |
508 | | - (4, 'Serbian')] |
509 | | -
|
510 | | - // Your output should look like this |
511 | | - console.log(mostSpokenLanguages(countries, 3)) |
512 | | - [ |
513 | | - (91, 'English'), |
514 | | - (45, 'French'), |
515 | | - (25, 'Arabic') |
516 | | - ]``` |
517 | | - |
518 | | - ```` |
519 | | - |
520 | | -1. \*\*\* Use countries_data.js file create a function which create the ten most populated countries |
521 | | - |
522 | | - ````js |
523 | | - console.log(mostPopulatedCountries(countries, 10)) |
524 | | - |
525 | | - [ |
526 | | - {country: 'China', population: 1377422166}, |
527 | | - {country: 'India', population: 1295210000}, |
528 | | - {country: 'United States of America', population: 323947000}, |
529 | | - {country: 'Indonesia', population: 258705000}, |
530 | | - {country: 'Brazil', population: 206135893}, |
531 | | - {country: 'Pakistan', population: 194125062}, |
532 | | - {country: 'Nigeria', population: 186988000}, |
533 | | - {country: 'Bangladesh', population: 161006790}, |
534 | | - {country: 'Russian Federation', population: 146599183}, |
535 | | - {country: 'Japan', population: 126960000} |
536 | | - ] |
537 | | - |
538 | | - console.log(mostPopulatedCountries(countries, 3)) |
539 | | - [ |
540 | | - {country: 'China', population: 1377422166}, |
541 | | - {country: 'India', population: 1295210000}, |
542 | | - {country: 'United States of America', population: 323947000} |
543 | | - ]``` |
544 | | -
|
545 | | - ```` |
546 | | -
|
547 | | -1. \*\*\* Try to develop a program which calculate measure of central tendency of a sample(mean, median, mode) and measure of variability(range, variance, standard deviation). In addition to those measures find the min, max, count, percentile, and frequency distribution of the sample. You can create an object called statistics and create all the functions which do statistical calculations as method for the statistics object. Check the output below. |
548 | | -
|
549 | | - ```js |
550 | | - const ages = [31, 26, 34, 37, 27, 26, 32, 32, 26, 27, 27, 24, 32, 33, 27, 25, 26, 38, 37, 31, 34, 24, 33, 29, 26] |
551 | | - |
552 | | - console.log('Count:', statistics.count()) // 25 |
553 | | - console.log('Sum: ', statistics.sum()) // 744 |
554 | | - console.log('Min: ', statistics.min()) // 24 |
555 | | - console.log('Max: ', statistics.max()) // 38 |
556 | | - console.log('Range: ', statistics.range() // 14 |
557 | | - console.log('Mean: ', statistics.mean()) // 30 |
558 | | - console.log('Median: ',statistics.median()) // 29 |
559 | | - console.log('Mode: ', statistics.mode()) // {'mode': 26, 'count': 5} |
560 | | - console.log('Variance: ',statistics.var()) // 17.5 |
561 | | - console.log('Standard Deviation: ', statistics.std()) // 4.2 |
562 | | - console.log('Variance: ',statistics.var()) // 17.5 |
563 | | - console.log('Frequency Distribution: ',statistics.freqDist()) # [(20.0, 26), (16.0, 27), (12.0, 32), (8.0, 37), (8.0, 34), (8.0, 33), (8.0, 31), (8.0, 24), (4.0, 38), (4.0, 29), (4.0, 25)] |
564 | | - ``` |
565 | | -
|
566 | | - ```sh |
567 | | - console.log(statistics.describe()) |
568 | | - Count: 25 |
569 | | - Sum: 744 |
570 | | - Min: 24 |
571 | | - Max: 38 |
572 | | - Range: 14 |
573 | | - Mean: 30 |
574 | | - Median: 29 |
575 | | - Mode: (26, 5) |
576 | | - Variance: 17.5 |
577 | | - Standard Deviation: 4.2 |
578 | | - Frequency Distribution: [(20.0, 26), (16.0, 27), (12.0, 32), (8.0, 37), (8.0, 34), (8.0, 33), (8.0, 31), (8.0, 24), (4.0, 38), (4.0, 29), (4.0, 25)] |
579 | | - ``` |
580 | 494 |
|
581 | 495 | 🎉 CONGRATULATIONS ! 🎉 |
582 | 496 |
|
583 | | -[<< Day 7](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/09_Day/09_day_function_programming.md) | [Day 9 >>](#) |
| 497 | +[<< Day 7](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/07_Day/07_day_functions.md) | [Day 9 >>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/07_Day/07_day_higher_order_function.md) |
0 commit comments