1919![ Day 5] ( ../images/banners/day_1_9.png )
2020
2121- [ Day 9] ( #day-9 )
22- - [ Higher Order Function] ( #higher-order-function )
23- - [ Callback] ( #callback )
24- - [ Returning function] ( #returning-function )
25- - [ setting time] ( #setting-time )
26- - [ setInterval] ( #setinterval )
27- - [ setTimeout] ( #settimeout )
28- - [ Functional Programming] ( #functional-programming )
29- - [ forEach] ( #foreach )
30- - [ map] ( #map )
31- - [ filter] ( #filter )
32- - [ reduce] ( #reduce )
33- - [ every] ( #every )
34- - [ find] ( #find )
35- - [ findIndex] ( #findindex )
36- - [ some] ( #some )
37- - [ sort] ( #sort )
38- - [ Sorting string values] ( #sorting-string-values )
39- - [ Sorting Numeric values] ( #sorting-numeric-values )
40- - [ Sorting Object Arrays] ( #sorting-object-arrays )
41- - [ 💻 Exercises] ( #-exercises )
42- - [ Exercises: Level 1] ( #exercises-level-1 )
43- - [ Exercises: Level 2] ( #exercises-level-2 )
44- - [ Exercises: Level 3] ( #exercises-level-3 )
22+ - [Higher Order Function](#higher-order-function)
23+ - [Callback](#callback)
24+ - [Returning function](#returning-function)
25+ - [Setting time](#setting-time)
26+ - [Setting Interaval using a setInterval function ](#setting-interaval-using-a- setinterval-function )
27+ - [Setting a time using a setTimeout](#setting-a-time-using-a- settimeout)
28+ - [Functional Programming](#functional-programming)
29+ - [forEach](#foreach)
30+ - [map](#map)
31+ - [filter](#filter)
32+ - [reduce](#reduce)
33+ - [every](#every)
34+ - [find](#find)
35+ - [findIndex](#findindex)
36+ - [some](#some)
37+ - [sort](#sort)
38+ - [Sorting string values](#sorting-string-values)
39+ - [Sorting Numeric values](#sorting-numeric-values)
40+ - [Sorting Object Arrays](#sorting-object-arrays)
41+ - [💻 Exercises](#-exercises)
42+ - [Exercises: Level 1](#exercises-level-1)
43+ - [Exercises: Level 2](#exercises-level-2)
44+ - [Exercises: Level 3](#exercises-level-3)
4545
4646# Day 9
4747
@@ -54,12 +54,12 @@ Higher order functions are functions which take other function as a parameter or
5454A callback is a function which can be passed as parameter to other function. See the example below.
5555
5656``` js
57- // a callback function, the function could be any name
57+ // a callback function, the name of the function could be any name
5858const callback = (n ) => {
5959 return n ** 2
6060}
6161
62- // function take other function as a callback
62+ // function that takes other function as a callback
6363function cube (callback , n ) {
6464 return callback (n) * n
6565}
@@ -71,7 +71,6 @@ console.log(cube(callback, 3))
7171
7272Higher order functions return function as a value
7373
74-
7574``` js
7675// Higher order function returning an other function
7776const higherOrder = n => {
@@ -90,7 +89,6 @@ Let us see were we use call back functions. For instance the _forEach_ method us
9089
9190``` js
9291const numbers = [1 , 2 , 3 , 4 ]
93-
9492const sumArray = arr => {
9593 let sum = 0
9694 const callback = function (element ) {
@@ -354,8 +352,8 @@ const scores = [
354352 { name: ' John' , score: 100 },
355353]
356354
357- const scoresGreaterEight = scores .filter ((score ) => score .score > 80 )
358- console .log (scoresGreaterEight )
355+ const scoresGreaterEighty = scores .filter ((score ) => score .score > 80 )
356+ console .log (scoresGreaterEighty )
359357```
360358
361359``` sh
0 commit comments