问题
HTTP:什么是HTTP持久化和管线化?
CSS:全兼容的多列均匀布局问题
JavaScript:数组的最大值
HTTP:什么是HTTP持久化和管线化?
https://www.cnblogs.com/hyzm/p/9530392.html
- HTTP持久化是针对HTTP无连接的特点进行改进的,使用的是keep-live首部字段保持长连接
- HTTP管线化是针对HTTP每次只能是请求一次回答一次的模式进行改进,使得可以连续发送多次请求。
CSS:全兼容的多列均匀布局问题
这种效果相当于flex的justify-content:space-between
https://github.com/chokcoco/iCSS/issues/52
<style>
.justify {
height: 100px;
text-align: justify;
/* text-align-last: justify; 兼容性不好 */
}
.justify div {
width: 104px;
height: 100px;
display: inline-block;
text-align: center;
background: blue;
}
.justify:after {
content: "";
display: inline-block;
position: relative;
width: 100%;
}
</style>
<div class="container">
<div class="justify">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
</div>
</div>
JavaScript:数组的最大值
1.ES6
var arr = [1,2,3];
Math.max(...arr) // 3
2.ES5
var arr = [1,2,3]
Math.max.apply(null,arr) // 3
// 我的理解是max是不需要this的,所以传null,传个字符串也不影响。
3.循环
var arr = [1,2,3,4,5,6]
var max = arr[0];
arr.forEach((item,index) => {max = item > max ? item : max})
max // 6