Korian Day 1 has been added

pull/283/head
Asabeneh 4 years ago
parent e14526cbd1
commit 6fbdea240c

@ -19,29 +19,29 @@
![Day 5](../images/banners/day_1_9.png) ![Day 5](../images/banners/day_1_9.png)
- [Day 9](#day-9) - [Day 9](#day-9)
- [Higher Order Function](#higher-order-function) - [Higher Order Function](#higher-order-function)
- [Callback](#callback) - [Callback](#callback)
- [Returning function](#returning-function) - [Returning function](#returning-function)
- [setting time](#setting-time) - [Setting time](#setting-time)
- [setInterval](#setinterval) - [Setting Interaval using a setInterval function](#setting-interaval-using-a-setinterval-function)
- [setTimeout](#settimeout) - [Setting a time using a setTimeout](#setting-a-time-using-a-settimeout)
- [Functional Programming](#functional-programming) - [Functional Programming](#functional-programming)
- [forEach](#foreach) - [forEach](#foreach)
- [map](#map) - [map](#map)
- [filter](#filter) - [filter](#filter)
- [reduce](#reduce) - [reduce](#reduce)
- [every](#every) - [every](#every)
- [find](#find) - [find](#find)
- [findIndex](#findindex) - [findIndex](#findindex)
- [some](#some) - [some](#some)
- [sort](#sort) - [sort](#sort)
- [Sorting string values](#sorting-string-values) - [Sorting string values](#sorting-string-values)
- [Sorting Numeric values](#sorting-numeric-values) - [Sorting Numeric values](#sorting-numeric-values)
- [Sorting Object Arrays](#sorting-object-arrays) - [Sorting Object Arrays](#sorting-object-arrays)
- [💻 Exercises](#-exercises) - [💻 Exercises](#-exercises)
- [Exercises: Level 1](#exercises-level-1) - [Exercises: Level 1](#exercises-level-1)
- [Exercises: Level 2](#exercises-level-2) - [Exercises: Level 2](#exercises-level-2)
- [Exercises: Level 3](#exercises-level-3) - [Exercises: Level 3](#exercises-level-3)
# Day 9 # Day 9
@ -54,12 +54,12 @@ Higher order functions are functions which take other function as a parameter or
A callback is a function which can be passed as parameter to other function. See the example below. A callback is a function which can be passed as parameter to other function. See the example below.
```js ```js
// a callback function, the function could be any name // a callback function, the name of the function could be any name
const callback = (n) => { const callback = (n) => {
return n ** 2 return n ** 2
} }
// function take other function as a callback // function that takes other function as a callback
function cube(callback, n) { function cube(callback, n) {
return callback(n) * n return callback(n) * n
} }
@ -71,7 +71,6 @@ console.log(cube(callback, 3))
Higher order functions return function as a value Higher order functions return function as a value
```js ```js
// Higher order function returning an other function // Higher order function returning an other function
const higherOrder = n => { const higherOrder = n => {
@ -90,7 +89,6 @@ Let us see were we use call back functions. For instance the _forEach_ method us
```js ```js
const numbers = [1, 2, 3, 4] const numbers = [1, 2, 3, 4]
const sumArray = arr => { const sumArray = arr => {
let sum = 0 let sum = 0
const callback = function(element) { const callback = function(element) {
@ -354,8 +352,8 @@ const scores = [
{ name: 'John', score: 100 }, { name: 'John', score: 100 },
] ]
const scoresGreaterEight = scores.filter((score) => score.score > 80) const scoresGreaterEighty = scores.filter((score) => score.score > 80)
console.log(scoresGreaterEight) console.log(scoresGreaterEighty)
``` ```
```sh ```sh

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -54,13 +54,14 @@
<small> January, 2020</small> <small> January, 2020</small>
</sub> </sub>
<div> <div>
🇬🇧 [English](./readMe.md) 🇬🇧 [English](./readMe.md)
🇪🇸 [Spanish](./Spanish/readme.md) 🇪🇸 [Spanish](./Spanish/readme.md)
🇷🇺 [Russian](./RU/README.md) 🇷🇺 [Russian](./RU/README.md)
KR [Korian](./Korea/README.md)
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save