TITLE


    Resumo/Informações
    • arguments, slice, cur

      ES5
      function isFullAge5() {
      //console.log(arguments);
      a) arguments é uma palavra que temos acesso em todas as funções, aqui utilizada para sabermos todos os argumentos dessa função.
      b) This will return [1990, 1999, 1965], which are the arguments passed to the function, however, this is an array-like stucture, but not an array. So it must be converted to an array.
      c) To use this return as an array, and be able to loop through it, we must transform it, using slice.
      var argsArr = Array.prototype.slice.call(arguments);

      argsArr.forEach(function(cur){ cur is the current element of the array that is being looped through
      console.log((2016 - cur) >= 18); in this case, the cur will be the years of the array, passed through arguments to the isFullAge5 function
      });
      }

      isFullAge(1990, 1999, 1965);