Function.prototype.bind2 = function() {
const arg = Array.from(arguments)
const one = arg.shift()
const self = this
return function() {
self.call(one, arg)
}
}
const res = fn.bind2({title: '名称'})
res()
this是在执行的时候决定的,作用域是在函数定义的时候决定的
转换类数组的两种方式
const arg = Array.from(arguments)
const arg = Array.prototype.slice.call(arguments) 通过改变this指
i++ 先赋值再加,
清除浮动
.clearFix{
&::after{
content: '';
display: table;
clear: both;
}
}
圣杯布局主要用的padding ,双飞翼布局用的margin 都是用margin负值
相邻元素的margin-top和margin-bottom会发生重叠
line-height: 如果设成百分比那么继承的就是百分比的值, 如果是1.5那个是当前元素的font-size的1.5倍
1.找准知识体系 结构化
2.刻意训练
3.及时反馈
typeof不能判断引用数据类型
何时使用===,何时使用==
==主要判断undefined和null的情况