Last active
March 8, 2016 11:06
-
-
Save WebReflection/4327762cb87a8c634a29 to your computer and use it in GitHub Desktop.
Revisions
-
WebReflection revised this gist
Mar 1, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ // Andrea Giammarchi, WTFPL function slice() {'use strict'; for (var o = +this, // offset i = o, // start index -
WebReflection created this gist
Mar 1, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ // Andrea Giammarchi, WTFPL function slice() { for (var o = +this, // offset i = o, // start index l = arguments.length, // length n = l - o, // new length a = Array(n < 0 ? 0 : n); // new Array i < l; i++ ) a[i - o] = arguments[i]; return a; } /** * @example (function () { slice.apply(0, arguments); // [1,2,3] slice.apply(1, arguments); // [2,3] slice.apply(6, arguments); // [] }(1,2,3)); */