How to use arguments object for a function in Node.js

1 Answer

0 votes
function findmax() {
    let max = 0;
      
    for (let i = 0; i < arguments.length; i++)  {
        if (arguments[i] > max) max = arguments[i];
    }
     
    return max;
} 
  
console.log(findmax(7, 18, 230, 899, 90, 800));
  
  
  
/*
run:
  
899
  
*/

 



answered Jun 25, 2024 by avibootz
...