//JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。
console.log("Hello world! - js.jsrun.net ");
// 防抖
// const debounce = (func, wait = 50) => {
// let timer = 0;
// return function(...args){
// if(time) clearTimeout(timer);
// timer = setTimeout(()=>{
// func.apply(this, args)
// }, wait)
// }
// }
// 节流--时间戳方式
// const throttle = (func, wait = 50) => {
// let lastTime = 0;
// return function(...args){
// const now = +new Date();
// if(now - lastTime > wait){
// setInterval(()=>{
// lastTime = now;
// func.apply(this, args)
// }, wait)
// }
// }
// }
function Foo() {
getName = function () {
console.log(1);
};
return this;
}
Foo.getName = function () {
console.log(2);
};
Foo.prototype.getName = function () {
console.log(3);
};
var getName = function () {
console.log(4);
};
function getName() {
console.log(5);
}
Foo.getName();
// Foo().getName();
getName();
new Foo.getName();
new Foo().getName();
new new Foo().getName();