function say(name) {
console.log("sayfn中name:" + name);
console.log(this);
}
function throttle(fn, delay) {
var lasttime = 0,
args = [].slice.call(arguments, 2);
return function() {
var now = +new Date();
if (now - lasttime > delay) {
fn.apply(window, args);
lasttime = now;
}
}
}
$(".demo").on("click", throttle(say, 2000, "hahaha"))