for example to find the highest value in a list of numbers using the => function:
const findMax = (...arguments) => {
let max = -Infinity;
for(let i = 0; i < arguments.length; i ){
if(arguments[i] > max){
max = arguments[i];
}
}
return max;
}
console.log(findMax(1, 53, 7, 12))
I was today’s old when I figured Js arguments object is not available in arrow functions.
To access the arguments passed to an arrow function, you can use the …rest parameter syntax, like this:
const findArguments = (…args) => {
console.log(args)
}
findArguments(8, 24)