b)
const square = (x) => x * x
const multi = (a) => {
R.pipe(
addition(a),
square
)
}
arr = [1,2,3]
const result = arr.map(x => multi(1))
console.log(result)
//[undefined,undefined,undefined]
why i am getting undefined ?
You are not returning anything from multi function
Source: const pow = R.flip(Math.pow); const square = pow(2); const multi = R.pipe(R.add, square); const arr = [1,2,3]; const result = R.map(R.partialRight(multi, [ 1 ]), arr) result Result: [ 4, 9, 16 ]
Обсуждают сегодня