Skip to content

Instantly share code, notes, and snippets.

View gaterking's full-sized avatar

gaterking gaterking

  • GuangZhou, China
View GitHub Profile
@gaterking
gaterking / apply.js
Last active March 19, 2019 07:07
call/apply/bind
/**
* 手动实现apply方法
*
*/
function fakeApply(context, arr) {
context.applyFn = this;
var args = [];
for (var i = 0; arr && i < arr.length; i++) {
args.push('arr[' + i + ']');
}