11 2023 档案
摘要:事例代码 var o = (function() { var obj = { a: 1, b: 2, } return { get: function(k) { return obj[k] } } })() 说明 如上一段代码,在不改变原代码的情况下,修改obj对象中的a、b属性。 分析 代码使用了
阅读全文
摘要:创建Star类 class Star { constructor(will, score, dom) { this.will = will; this.score = score; this.dom = dom; } init() { const that = this; this.dom.forE
阅读全文
摘要:柯里化就是将多参函数变成单参函数 // 实现函数柯里化 function currying() { } // 测试柯里化函数 const sum = (a, b, c, d) => a + b + c + d; console.log(currying(sum)(1)(2)(3)(4)); // 1
阅读全文
⬆️
⬇️