摘要:
一 通过闭包存储 let CPrivate = function(value){ let _private = value; return { getValue:()=> _private, setValue:(value)=> {_private = value} } } 二 通过Symbol创建 阅读全文
摘要:
一 TS2538: Type 'symbol' cannot be used as an index type. ts 中使用 let 定义 Symbol类型值时候会报改错误,将let 改为const 即可。 解析:Symbol的值为不可变的值,故应该定义为常量而不是变量 阅读全文
摘要:
一 只传递一个参数时候 let str = '0123456'; str.slice(5); //'56' str.substr(5); // '56' str.substring(5); // '56' str.slice(-2); // '56' str.substr(-2); // '56' 阅读全文