if (!checks[i](arguments[i])) { alert( "Некорректный тип аргумента номер " + i ); return; } 

    3 answers 3

    If the variable checksi is false , 0 , NaN , undefined , null or "" display the message: "Invalid type of argument number", adding to it the value of the variable i .

    • thank!!!!!!!!! - aleksei

    If checksi does not exist, then we give the message "Incorrect type of argument number" and number (which is in i)

      You have to think of:

      Presumably, an external code like this:

       function some(){ for(let i = 0; i < arguments.length; i++){ if (!checks[i](arguments[i])) { alert( "Некорректный тип аргумента номер " + i ); return; } } } 

      This assumes that there is a checks object whose keys are made like this: 0: function(e){...}, 1: function(e){...}, ...
      The cycle goes through all the arguments, calling the checks in turn its numerical methods, passing there another regular function argument; if the call returns false (or its presentation), an alert will occur and exit the some function.
      For example:
      some('hello', 'world') will call checks[0]('hello') and checks[1]('world') .

      This is clumsy and stupid, do not use this.

      • it may be an array of methods, not just an object :) - Vasily Barbashev
      • @ Vasily Barbashev, and you are observant and right, sir! Only Array is a special case of the object. In any case, it turns out the same thing, this check is better not to become. - user207618