Please anyone help me to identify which is a lamda function in this assignment…
there are three function i.e; prepareGreenTea, prepareBlackTea, prepareTea
This article (not mine) is what I thought lambdas were, moving from python:
map
, reduce
and filter
are functions that apply a lambda
to each value in an array and return a new value.
for example
let shortList = myList.filter(x => x.length >= 10)
a lambda (the arrow function) is passed in to the filter function.
the lambda
returns true or false for each value in the array, and the filter
pushes the true values in to a new array.
in the exercise you looked at, the lambdas are named prepareBlackTea
and prepareBlackTea
. They are passed in to the getTea
function as the prepareTea
argument.