I am trying to return the largest element in a list page
:
page = [1,2,3];
R.max(page); // returns a function.
R.max(-Infinity, page); // seems correct but doesn't work as expected.
I don't have the ramda
package installed, so this is untested, but from the documentation max() only takes two arguments, so you would have to reduce() your array upon it:
var page = [1, 2, 3],
result = R.reduce(R.max, -Infinity, page);
// 'result' should be 3.
Use the apply
function: https://ramdajs.com/0.22.1/docs/#apply
const page = [1, 2, 3];
R.apply(Math.max, page); //=> 3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With