答案:
js有哪几种数据类型:
object(复杂类型)
number function boolean undefined string symbol(ES6)(基本类型)
其中typeof isNaN //Functionhtml
答案:
面向对象和面向过程是两种不一样的编程思想。vue
答案:
1) 箭头函数是匿名函数,不能做为构造函数,不能使用new
2) 箭头函数不绑定arguments,取而代之用rest参数...解决
3) 箭头函数不绑定this,会捕获其所在的上下文的this值,做为本身的this值
4) 箭头函数经过call()
或apply()
方法调用一个函数时,只传入了一个参数,对 this 并无影响。
5) 箭头函数没有原型属性
6) 箭头函数不能当作Generator函数,不能使用yield关键字html5
答案:
eval() 函数计算 JavaScript 字符串,并把它做为脚本代码来执行es6
以防止一个函数被无心义的高频率调用
防抖: 触发事件后在 n 秒内函数只能执行一次,若是在 n 秒内又触发了事件,则会从新计算函数执行时间。编程
节流: 指连续触发事件可是在 n 秒中只执行一次函数
https://www.jianshu.com/p/c8b86b09daf0json
HTML5 如今已经不是 SGML(标准通用标记语言,是一种定义电子文档结构和描述其内容的国际标准语言) 的子集,主要是关于图像,位置,存储,多任务等功能的增长。api
新标签:
文档类型设定:<!doctype html>
字符设定:
数组
增强语义化:浏览器
浮动引发的问题:
1)子元素浮动致使父元素内高度为0,父级盒子不能被撑开,发生高度塌陷,父元素背景不能正常显示,边框不能被撑开,margin和padding值不能正常显示。
2)与子元素同级的非浮动元素会被遮盖
如何清除浮动?
1)给父元素设置合适的高度
2)给父元素添加样式:overflow:hidden/auto
,这个属性至关于触发了BFC,让父级紧贴内容
3)在最后一个子元素的后面追加一个空元素,并为其添加样式.clear{clear:both};
4)采用为元素,给父元素后面追加:after
,并设置样式为.clearfix{content:""; clear:both; display:block;}
缓存
localStorage在全部同源窗口中都是共享的
<html manifest = "demo.appcache">...</html>
text/cache-manifest
。Application Cache的三个优点:
① 离线浏览
② 提高页面载入速度
③ 下降服务器压力
http://www.javashuo.com/article/p-hmzkrrnw-dp.html
var link = function(height = 50, color = 'red', url = 'http://azat.co') { ... }
//ES5 var name = 'Your name is ' + name + '.' var url = 'http://localhost:3000/api/messages/' + id //ES6 var name = `Your name is ${first} ${last}` var url = `http://localhost:3000/api/messages/${id}`
for(var i = 0; i < 10; i++){ setTimeout(function(){ console.log(i) },10) }
输出:10个10
//改进: for(var i = 1; i <= 10; i++){ (function(i){ setTimeout(function(){ console.log(i) },10) })(i); } //改进2: for(let i = 0; i <= 10; i++){ setTimeout(function(){ console.log(i) },10) }
white-space:nowrap;/*强制在一行显示*/ overflow:hidden;/*超出部分隐藏*/ text-overflow:ellipsis;/*文本超出部分用省略号代替*/
<style> *{ margin: 0; padding: 0; } .left{ width: 200px; float: left; height: 400px; background-color: #99F; } .main{ height: 400px; background: #ccc; } </style> <body> <div class="left">左侧</div> <div class="main">主要</div> </body>
<style> *{ margin: 0; padding: 0; } .left{ width: 200px; position: absolute; top: 0; left: 0; height: 400px; background-color: #99F; } .main{ margin-left: 200px; height: 400px; background: #ccc; } </style> <body> <div class="left">左侧</div> <div class="main">主要</div> </body>
<style> *{ margin: 0; padding: 0; } body{ display: flex; } .left{ width: 200px; height: 400px; background-color: #99F; } .main{ height: 400px; background: #ccc; flex: 1; } </style> <body> <div class="left">左侧</div> <div class="main">主要</div> </body>
<style> *{ margin: 0; padding: 0; } .left{ width: 200px; height: 400px; float: left; background-color: #99F; } .main{ height: 400px; background: #ccc; } .right{ width: 200px; height: 400px; float: right; background-color: #99F; } </style> <body> <div class="left">左侧</div> <div class="right">右侧</div> <div class="main">主要</div> </body>
<style> *{ margin: 0; padding: 0; } .left,.right{ width: 200px; height: 400px; background-color: #99F; position: absolute; top: 0; } .left{ left:0; } .main{ height: 400px; background: #ccc; margin: 0 200px; } .right{ right: 0; } </style> <body> <div class="left">左侧</div> <div class="right">右侧</div> <div class="main">主要</div> </body>
<style> *{ margin: 0; padding: 0; } body{ display: flex; } .left,.right{ width: 200px; height: 400px; background-color: #99F; } .main{ height: 400px; background: #ccc; flex: 1; } </style> <body> <div class="left">左侧</div> <div class="main">主要</div> <div class="right">右侧</div> </body>