自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(5)
  • 收藏
  • 关注

原创 函数柯里化 ,经典面试题

function currying(fn,length){ return function(...args){ if(args.length>=length){ return fn(...args) } // bind()函数既保留了上一个调用的参数,又返回一个新函数 return currying(fn.bind(null,...args),length-args.length) }}function add(...args){ retur

2020-11-23 23:30:57 609

原创 原型与原型链

function fu() {}var son = new fu();console.log(fu); // 函数fuconsole.log(fu.prototype.constructor); // 就是fuconsole.log(Object);console.log(Object.prototype.constructor); // 就是Objectconsole.log(son.__proto__); // 实例对象的__proto__属性即他的原型console.log(fu.

2020-11-10 23:27:14 132

原创 js实现bind简单易懂

var name = "她";var o = { name: "你",};function fn(a, b) { console.log(a + b + this.name);}Function.prototype._bind = function(obj, ...args) { // 返回一个新函数 return (...arr) => { return this.call(obj, ...args, ...arr); // this即fn };};fn._

2020-10-15 17:17:54 199

原创 js实现快排简单易懂

var arr = [4,3,6,2,6,8,9,0,1]function quick(args) { if (args.length <= 1) { return args; } let compare = args.shift(), // 拿出第一个作为比较值 left = [], // 装小的 right = []; // 装大的 for (let i = 0; i < args.length; i++) { if (args[i] &lt

2020-10-14 19:48:45 248

原创 ES6实现call方法

//模拟call方法Function.prototype.call_ = function(obj, ...args) { obj = obj ? Object(obj) : window; obj.fn = this; // this即fn obj.fn(...args); delete obj.f;};var name = "她";var o = { name: "你",};function fn(a, b) { console.log(a + b + this.na

2020-10-11 21:09:24 467

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除