Skip to content

Instantly share code, notes, and snippets.

View Michaelooo's full-sized avatar
🎯
Focusing

Michael Cheng Michaelooo

🎯
Focusing
View GitHub Profile
@Michaelooo
Michaelooo / apply_bind_new.js
Last active August 12, 2021 07:27
code-snippets
// apply 的模拟实现
Function.prototype.apply = function(context, arr) {
var context = Object(context) || window;
context.fn = this;
var result;
if (!arr) {
result = context.fn();
} else {
var args = [];