一面问的问题确实基础,基础到难以置信,现在已经裂开
开始直接写CSS代码,着实懵逼了
一.父子div布局,子div相对于父级垂直且水平居中的写法
一共写出两种写法:
//flex布局
.parent {
display: flex;
align-items: center;
justify-content: center
}
.parent {
width: 500px;
height: 300px;
background-color: skyblue;
position: relative;
}
.children {
width: 100px;
height: 100px;
background-color: green;
position: absolute;
left: 50%;
margin-left: -50px;
}
二.判断数组的方法
- Array.isArray()
- instanceof
- Object.prototype.toString()
三.查找数组中的最大值
1.Math.max.apply(null,arr) 这个答案真是给自己挖了一个坑
2.
let max = arr[0]
for(var i = 0; i < arr.length - 1; i++){
max = max < arr[i + 1] ? arr[i + 1] , max
}
arr.sort((num1 , num2) => {
return num1 - num2 < 0
})
arr[0]
四.是否知道ES6中的…
答:可以用来复制数组
五.写一下如何复制数组
const arr1 = […arr]
六.说一下call,apply,bind的区别
这道题不会啊。。。
查了一下答案:
1、相同点:
三个函数都会改变this的指向(调用这三个函数的函数内部的this)
2、不同点:
1)、bind会产生新的函数,(把对象和函数绑定死后,产生新的函数)
2)、call和apply不会产生新的函数,只是在调用时,绑定一下而已。
3)、call和apply的区别,第一个参数都是要绑定的this,apply第二个参数是数组(是函数的所有参数),call把apply的第二个参数单列出来。
原文链接:https://blog.youkuaiyun.com/jiang7701037/article/details/99975245
七.apply方法还有哪些应用场景
还是不会,给自己挖坑挖的好深
这篇文章写得很详细:!!!
https://blog.youkuaiyun.com/business122/article/details/8000676?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.control&dist_request_id=&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.control