Skip to content

Instantly share code, notes, and snippets.

@deathping1994
Created March 12, 2016 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deathping1994/97cc4e26bf4b28455c8d to your computer and use it in GitHub Desktop.
Save deathping1994/97cc4e26bf4b28455c8d to your computer and use it in GitHub Desktop.
var add=function()
{
if(arguments.length==0)
{return 0
}
else{
let args=[].slice.call(arguments,0)
args.splice(0,1)
return arguments[0]+add.apply(this,args)//needtoreadaboutapply
}
}
var x=add(3,4,5)
console.log(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment