SeanGXY
SeanGXY
全部文章
题解
归档
标签
去牛客网
登录
/
注册
SeanGXY的博客
全部文章
/ 题解
(共14篇)
题解 | #共同父亲dom节点查找#
function commonParentNode(oNode1, oNode2) { let arr1 = [oNode1]; let arr2 = [oNode2]; let DOM1 = oNode1.parentNode; le...
HTML/CSS/JavaScript
2022-05-08
3
274
题解 | #深拷贝函数实现#
const _completeDeepClone = (target, map = new Map()) => { // map 用来记录是否已经被拷贝过 // 补全代码 if(typeof target == "object" && target !==...
HTML/CSS/JavaScript
2022-05-08
3
484
题解 | #浅拷贝#
const _shallowClone = target => { if(typeof target == "object" && target !== null){ // Array,null 的 type 类型也是 obje...
HTML/CSS/JavaScript
2022-05-08
0
275
题解 | #实现new操作符#
// 目的是使用 new() 方法创建一个 className 类的实例化对象,代替 new className(参数) 的方法 const _new = function(className,...args) { //if(typeof className !== "function") ...
HTML/CSS/JavaScript
2022-05-08
4
236
题解 | #_call函数#
Function.prototype._call = function(target,...args){ target = (typeof target == "object" ? target : window); // 保证要指向的是对象类型 target["temporary"] = ...
HTML/CSS/JavaScript
2022-05-07
0
227
题解 | #合法的URL#
// 补全代码 // 开始符 ^ // 协议部分http(s):// 表示为((https|http|ftp|rtsp|mms)?:\/\/) // 域名部分 表示为(([A-Za-z0-9]+-[A-Za-z0-9]+|[A-Za-z0-9]+)\.)+ // 顶级域名com cn等...
HTML/CSS/JavaScript
2022-05-07
21
899
题解 | #观察者模式#
// 补全代码 class Observerd { constructor(name){ this.name=name, this.state="走路" this.Observers = [] } setObserver(Observer){ // 保...
HTML/CSS/JavaScript
2022-05-07
0
298
题解 | #发布订阅模式#
class EventEmitter { // 补全代码 constructor(){ this.obj={} } on(name,fn){ let result = this.obj; if(!result[name]){ ...
HTML/CSS/JavaScript
2022-05-07
0
222
题解 | #寄生组合式继承#
function Human(name) { this.name = name this.kingdom = 'animal' this.color = ['yellow', 'white', 'brown', 'black'] } Human.prototype.getName = f...
HTML/CSS/JavaScript
2022-05-06
0
193
题解 | #Object.freeze#
const _objectFreeze = object => { // 补全代码 if(typeof object == null) return // typeof Array和 typeof Null 等于Object for(let k in object ...
HTML/CSS/JavaScript
2022-05-06
0
297
首页
上一页
1
2
下一页
末页