js节流: https://blog.csdn.net/qq_31754523/article/details/108343818
var timer = null;
function debounce(fn, wait) {
if (timer !== null) {
clearTimeout(timer);
}
timer = setTimeout(fn, wait);
}
function test(){
console.log(123);
}
window.addEventListener("resize",debounce(test,1000));
//改变窗口大小,观察浏览器控制台的变化