Skip to content

Instantly share code, notes, and snippets.

@khanghoang
Created October 31, 2015 17:25
Show Gist options
  • Save khanghoang/93b24d7ffb4e107eed4b to your computer and use it in GitHub Desktop.
Save khanghoang/93b24d7ffb4e107eed4b to your computer and use it in GitHub Desktop.
Example
var func = function(a, b) {
console.log(“funcLength is”, this.length);
var totalArgs = Array.prototype.slice.call(arguments, 0);
console.log(“, totalArgs is”, totalArgs.length);
}
func.call(func, [1]); // Output: funcLength is 2, totalArgs is 1
func.call(func, [1, 2, 3]); // Output: funcLength is 2, totalArgs is 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment