摘要: js 加法 1:两个都是原始类型 若一个是字符串 则另一个转变为字符串 若一个是原始类型 则按原始类型转number 2:若不是原始类型,则按对象[Symbol.toPrimitive] valueOf() toString() 依次转换 var obj = { a: 2, [Symbol.toPr 阅读全文
posted @ 2024-08-29 17:21 howhy 阅读(3) 评论(0) 推荐(0) 编辑
摘要: const READ = 0b1; const CREATE = 0b10; const UPDATE = 0b100; const DELETE = 0b1000; const rights = READ | UPDATE | DELETE //组合权限读 更新 删除 13 console.log 阅读全文
posted @ 2024-08-02 17:17 howhy 阅读(6) 评论(0) 推荐(0) 编辑
摘要: function concurRequest(maxnum) { return new Promise((resolve, reject) => { let index = 0 let count = 0 const results = [] async function request() { c 阅读全文
posted @ 2024-08-02 11:34 howhy 阅读(2) 评论(0) 推荐(0) 编辑
摘要: function fun1(ss) { console.log(ss + "1") return 'b' } function fun11(ss) { console.log(ss + "11") return 'ab' } function fun12(ss) { console.log(ss + 阅读全文
posted @ 2024-07-30 13:52 howhy 阅读(5) 评论(0) 推荐(0) 编辑
摘要: function deepClone(value){ const map=new WeakMap() function _deepClone(value){ if(value null || typeof value !== 'object'){ return value } if(map.has( 阅读全文
posted @ 2024-07-29 17:42 howhy 阅读(2) 评论(0) 推荐(0) 编辑
摘要: names=['张三','李四','阿猫','王五','岳云鹏'] names.sort((a,b)=>a.localeCompare(b)) 阅读全文
posted @ 2024-07-29 16:34 howhy 阅读(1) 评论(0) 推荐(0) 编辑
摘要: class Person { constructor(name, age) { this.name = name this.age = age } } function creataOnlyOneCls(target) { let cls; return new Proxy(target, { co 阅读全文
posted @ 2024-07-26 16:21 howhy 阅读(2) 评论(0) 推荐(0) 编辑
摘要: function createFunOverLoad() { const funMap = new Map() console.log(funMap) const funOverLoad = function (...args) { const key = args.map(param => typ 阅读全文
posted @ 2024-07-26 15:47 howhy 阅读(6) 评论(0) 推荐(0) 编辑
摘要: const calculator = { count: 0, next() { return ++this.count }, double(a) { return a * 2 }, add(a, b) { return a + b } } calculator.add(2, 3) // functi 阅读全文
posted @ 2024-07-18 18:21 howhy 阅读(5) 评论(0) 推荐(0) 编辑
摘要: const customConfig = { a: 22, b: 33 } function config(config = {}) { const defaultConfig = { a: 12, b: 23, c: 'aa' } const finallyConfig = { ...defaul 阅读全文
posted @ 2024-07-18 18:02 howhy 阅读(8) 评论(0) 推荐(0) 编辑