上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 36 下一页
摘要: 以相同顺序初始化对象成员,避免隐藏类的调整 JavaScript是动态类型的,变量是没有类型的(值才有),但是在编译器解析的时候,会给对象的属性赋予一个类型(叫做hiddenClass,多达21种类型),以相同顺序初始化对象成员,可以避免类的调整。 const p1 = { name: 'zjy'} 阅读全文
posted @ 2023-01-24 23:01 671_MrSix 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 服务端生成二维码ID为唯一值 阅读全文
posted @ 2022-04-22 16:56 671_MrSix 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 常见写法 1 let addEvent = (ele, type, handler) => { 2 if (window.addEventListener) { 3 return ele.addEventListener(type, handler, false); 4 } 5 if (window 阅读全文
posted @ 2022-04-20 21:43 671_MrSix 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 编写递归函数时,必须告诉它何时停止递归。 递归指的是调用自己的函数。 每个递归函数都有两个条件:基线条件和递归条件。 栈有两种操作:压入和弹出。 所有函数调用都进入调用栈。 调用栈可能很长,这将占用大量的内存。 阅读全文
posted @ 2022-02-07 16:47 671_MrSix 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 数组 链表 读取 O(1) O(n) 插入 O(n) O(1) 删除 O(n) O(1) 阅读全文
posted @ 2022-02-07 15:53 671_MrSix 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 循环方式 const binarySearchByLoop = (arr = [0,1,2,3,4,5,6,7,8,9],target = 9) => { const { length } = arr let startIndex = 0 let endIndex = length - 1 whil 阅读全文
posted @ 2022-02-07 15:43 671_MrSix 阅读(39) 评论(0) 推荐(0) 编辑
摘要: /** * ts泛型工具 内置类型定义 */ // Partial的作用是将传入的属性变成可选项,原理就是使用keyof拿到所有的属性名,然后在使用in遍历,T[P]拿到相应的值 type Partial<T> = {[P in keyof T]?: T[P]}; // Required的作用是将传 阅读全文
posted @ 2021-12-01 19:17 671_MrSix 阅读(341) 评论(0) 推荐(0) 编辑
摘要: Babel:Babel 是一个广泛使用的 ES6 转码器,可以将 ES6 代码转为 ES5 代码。 注意:Babel 默认只转换新的 JavaScript 句法(syntax),而不转换新的 API。 Polyfill:Polyfill的准确意思为,用于实现浏览器并不支持的原生API的代码。 1 / 阅读全文
posted @ 2021-09-09 00:22 671_MrSix 阅读(284) 评论(0) 推荐(0) 编辑
摘要: 函数装饰器 MethodDecorator = <T>(target: Object, key: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | Void; 属性装饰器 PropertyD 阅读全文
posted @ 2021-08-21 15:14 671_MrSix 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 1 export function section(): void { 2 const ul = document.getElementById('ul'); 3 const total = 10001; 4 const once = 20; 5 function loop(curTotal: nu 阅读全文
posted @ 2021-08-17 22:39 671_MrSix 阅读(34) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 36 下一页