Created
October 31, 2015 17:25
-
-
Save khanghoang/93b24d7ffb4e107eed4b to your computer and use it in GitHub Desktop.
Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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