WebMasterCampus
WEB DEVELOPER Resources

Javscript ES6 Function Rest Parameter

Learn Javascript ES6 Function Rest Parameter


ES6 Function Rest Parameter

The rest parameter allows a function to treat an indefinte number of arguments as array.

ES6 Function Rest Parameter Example


function sum(...args){

  let result = 0;

  for(let arg of args)
    result +=  arg;

  return result;
}


console.log(sum(5,6));
Created with love and passion.