刷前端面經筆記(一)

2021-09-12 18:01:47 字數 1692 閱讀 7945

1.css的盒子模型

包含元素內容content、內邊距padding、邊框border、外邊距margin

box-sizing:border-box;content-box;inherit;

1)content-box:總寬度=margin+border+padding+width,即為標準模型;

2)border-box:總寬度=margin+width,即為ie模型;

3)inherit:繼承父元素的border-sizing屬性。

2.ajax的readystate幾種狀態

0——初始化

1——載入

2——載入完成

3——解析

4——完成

3.常見的post提交資料方式對應的content-type取值

4.清除浮動的幾種方法

1)父級div定義偽類:afterzoom

`.clearfloat::after

.clearfloat `

2)在結尾處新增空div標籤clear:both

3)父級div定義height

4)父級div定義display:table

5)父級div也一起浮動

6)父級div定義overflow:auto/hidden(必須定義widthzoom:1,同時不能定義height,瀏覽器會自動檢查浮動區域的高度)

5.webpack解析es6用的外掛程式

babel-loader

6.移動端上click事件在某些瀏覽器有沒有遇到延遲的問題

1)靜止縮放

2)引入`fastclick.js

window.addeventlistener(function(),false)`

7.http的快取機制

1)強制快取:當所請求的資料在快取資料庫中尚未過期時,不與伺服器進行互動,直接使用快取資料庫中的資料。

expire / cache-control

2)協商快取:從快取資料庫中取出快取的標識,然後向瀏覽器傳送請求驗證請求的資料是否已經更新,如果已更新則返回新的資料,若未更新則使用快取資料庫中的快取資料。

刷前端面經筆記(十二)

1.以下遞迴函式存在棧溢位的風險,請問如何優化?function factorial n 解答 function factorial n 2.請實現乙個計算最大公約數的函式 function greatestcommondivisor a,b greatestcommondivisor 8,12 4...

刷前端面經筆記(十二)

1.以下遞迴函式存在棧溢位的風險,請問如何優化?function factorial n 解答 function factorial n 2.請實現乙個計算最大公約數的函式 function greatestcommondivisor a,b greatestcommondivisor 8,12 4...

刷前端面經筆記(十二)

1.以下遞迴函式存在棧溢位的風險,請問如何優化?function factorial n 解答 function factorial n 2.請實現乙個計算最大公約數的函式 function greatestcommondivisor a,b greatestcommondivisor 8,12 4...