最近在工作中遇到的某些知识点不记得,就随手记下来有空翻翻加深印象吧,菜鸡要多吃菜才能长高高。
JS
undefined === void 0;
=> true
//解:除了防止被重写外,还减少字节。void 0代替undefined省了3个字节
const array1 = [1,2,3,4];
console.log(array1.fill(0,2,4));
=> [1,2,0,0]
console.log(array1.fill(5,1));
=> [1,5,5,5]
console.log(array1.fill(6));
=> [6,6,6,6]
!!typeof('11')
=> true
typeof('11')
=> string
function render(callback?:() => void): string;
//解:参数的意思是callback的返回值是函数,返回函数的返回值是void
function render(callback?:void):string
//解:参数的意思是callback的返回值是void