var isClick = true if (isClick) { //防止过快点击 ///do someing isClick = false; setTimeout(function() { isClick = true; }, 400); }