08 2020 档案

摘要:this的取值是在执行的地方确定的,不是定义的时候 function fn1() { console.log(this) } fn1() // window fn1.call({ x: 100 }) // { x: 100 } const fn2 = fn1.bind({ x: 200 }) fn2 阅读全文
posted @ 2020-08-15 11:08 大海博客
摘要:1.函数作为参数被传递 2.函数作为返回值被返回 函数定义的地方和执行的地方不一样 自由变量的查找,是在函数定义的地方,向上级作用域查找,不是在执行的地方!适用于所有情况,包括闭包。 阅读全文
posted @ 2020-08-15 10:39 大海博客
摘要:原型 prototype 1.每个class都有显示原型 2.每个实例都有隐式原型__proto__ 3.实例的__proto__指向对应class的prototype 原型链 阅读全文
posted @ 2020-08-14 19:23 大海博客
摘要://父类 class People { constructor(name) { this.name = name } eat() { console.log(`eat: 姓名 ${this.name}`) } } //子类 class Student extends People { constru 阅读全文
posted @ 2020-08-14 18:42 大海博客
摘要:function deepClone(obj = {}){ if(typeof obj !== 'object' || obj == null){ // 不是对象和数组 或者 是null return obj } let result if(obj instanceof Array){ result 阅读全文
posted @ 2020-08-13 16:37 大海博客
摘要:定义 相对于根元素(html)的相对长度单位 media-query 响应式 @media only screen and (max-width: 374px) { html { font-size: 86px } } @media only screen and (min-width: 375px 阅读全文
posted @ 2020-08-13 13:44 大海博客
摘要:水平居中 inline 元素:text-align: center; block 元素:margin: auto; absolute 元素:left: 50% + margin-left负值 (必须知道子元素的宽度) 垂直居中 inline 元素:line-height的值等于height的值 (必 阅读全文
posted @ 2020-08-13 13:15 大海博客