samdark / yiiframework-ru

yiiframework.ru
http://yiiframework.ru/
Other
52 stars 21 forks source link

Hi! Help me resolve one little problem from this task #147

Closed ghost closed 4 years ago

ghost commented 4 years ago

// I put arguments.length = 0 || null and i want to get 0 at final , but at this case it doesn't work and it returns undefined. what's wrong??

function mostNumbers(numbers){ for (var i = 0; i < arguments.length; ++i) { let args = Array.prototype.slice.call(arguments); let x = Math.max(...args) ; let y = Math.min(...args); let result;

   if (arguments.length === 0 || arguments.length ===null )  return 0;          
     return result = x - y  ;
               }
  }
             console.log (mostNumbers() );