single responsibility principle
and how does it apply to components?
https://eloquentjavascript.net/05_higher_order.html#h_xxCc98lOBK
greaterThan
function as defined in the reading. In your own words, what is line 2 of this function doing?
true
or false
. In order to call greaterThan and have it compare, an additional argument is required to be passed into the function. For example, greaterThan(10)(20)
would return true
, but greaterThan(10)(5)
would return false
.map
or reduce
operates, with regards to higher-order functions.
map
is a method that can applied to arrays to iterate through each index of the array to apply some function and return a new array. map
requires an additional function to be passed in the argument to apply to each index value of the array. For example, in the code below, the map
method would create a new array called newArr
that would have the value of [4,12,2,16]
.let arr = [ 2, 6, 1, 8];
let newArr = arr.map(value => {
return value*2;
})