摘要: 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 大海博客 阅读(102) 评论(0) 推荐(0)
摘要: 1.函数作为参数被传递 2.函数作为返回值被返回 函数定义的地方和执行的地方不一样 自由变量的查找,是在函数定义的地方,向上级作用域查找,不是在执行的地方!适用于所有情况,包括闭包。 阅读全文
posted @ 2020-08-15 10:39 大海博客 阅读(66) 评论(0) 推荐(0)
摘要: 原型 prototype 1.每个class都有显示原型 2.每个实例都有隐式原型__proto__ 3.实例的__proto__指向对应class的prototype 原型链 阅读全文
posted @ 2020-08-14 19:23 大海博客 阅读(78) 评论(0) 推荐(0)
摘要: //父类 class People { constructor(name) { this.name = name } eat() { console.log(`eat: 姓名 ${this.name}`) } } //子类 class Student extends People { constru 阅读全文
posted @ 2020-08-14 18:42 大海博客 阅读(100) 评论(0) 推荐(0)
摘要: 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 大海博客 阅读(72) 评论(0) 推荐(0)
摘要: 定义 相对于根元素(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 大海博客 阅读(81) 评论(0) 推荐(0)
摘要: 水平居中 inline 元素:text-align: center; block 元素:margin: auto; absolute 元素:left: 50% + margin-left负值 (必须知道子元素的宽度) 垂直居中 inline 元素:line-height的值等于height的值 (必 阅读全文
posted @ 2020-08-13 13:15 大海博客 阅读(90) 评论(0) 推荐(0)
摘要: { "git.path": "D:\\Git\\cmd\\git.exe", "workbench.colorTheme": "Monokai", "workbench.iconTheme": "vscode-icons", "editor.tabSize": 2, "window.zoomLeve 阅读全文
posted @ 2020-07-14 10:13 大海博客 阅读(212) 评论(0) 推荐(0)
摘要: window.innerWidth 100vw 网页视口宽度 window.innerHeight 100vh 网页视口高度 1.vw:1vw等于网页视口宽度的1%。2.vh:1vh等于网页视口高度的1%。3.vmin:选取vw和vh中最小的那个。4.vmax:选取vw和vh中最大的那个。 wind 阅读全文
posted @ 2020-07-13 16:34 大海博客 阅读(392) 评论(0) 推荐(0)
摘要: 常用的class命名规则: 头:header head 页面主体:main body main-content page-main 内容:content container 导航:nav navigation 子导航:subnav 侧栏:sidebar aside 栏目:column 菜单:menu 阅读全文
posted @ 2020-07-13 16:24 大海博客 阅读(120) 评论(0) 推荐(0)