自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Promise.all哪怕一个请求失败了也能得到其余正确的请求结果的解决方案

Promise.all( [ Promise.reject({ code: 500, msg: "服务异常" }), Promise.resolve({ code: 200, list: [] }), Promise.resolve({ code: 200, list: [] }) ].map(p => p.catch(e => e))) .the...

2020-03-23 16:14:40 6591

原创 a == 1 && a == 2 && a == 3为true

三种实现方式let a = { i: 1, toString: function() { return this.i++; }};let a = new Proxy({}, { i: 1, get: function() { return () => this.i++ } });//数组的 toString 默认调用数...

2020-03-17 14:17:50 122

原创 深拷贝

function deepClone(obj) { function isObject(o) { return (typeof o === "object" || typeof o === "function") && o !== null; } if (!isObject(obj)) { throw new Error("非对象"); } le...

2020-03-17 14:12:50 79 1

原创 new的实现原理

// 创建一个空的新对象// 链接到原型// 绑定this// 返回新对象function _new() { let obj = {}; let [constructor, ...args] = [...arguments]; obj.__proto__ = constructor.prototype; let result = constructor.apply(obj...

2020-03-16 18:34:38 126

原创 instanceof 的原理

instanceof 可以正确的判断对象的类型,因为内部机制是通过判断对象的原型链中是不是能找到类型的 prototype。instanceof 实现如下:function myInstanceof(left, right) { var prototype = right.prototype var left = left.__proto__ while (true) { i...

2020-01-07 15:03:32 159

原创 call,apply和bind原生实现

call实现Function.prototype.newCall = function (context, ...parameter) { if (typeof context === 'object' || typeof context === 'function') { context = context || window } else { context ...

2020-01-05 18:37:45 71

空空如也

空空如也

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

TA关注的人

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