window.onscroll = function() {
if (window.scrollY>200) {
$('.footer').show();
} else {
$('.footer').hide();
}
};
function a() {
console.log('a_'+Date.now());
}
function b() {
console.log('b_'+Date.now());
}
function c() {
console.log('c_'+Date.now());
}
function que() {
funs = [a, b, c];
funs.forEach((f, i) => {
setTimeout(f, i*1000);
});
}
que();
or (let i = 0; i < 10; i++) {
setTimeout(function () {
console.log(i); // ?
}, 0);
}
(function() {
return arguments.callee;
})()()()().... ;
function namedFunc() {
return namedFunc;
}
namedFunc()()()().... ;
var storedFunc = function() {
return storedFunc;
};
storedFunc()()()().... ;
let sel = window.getSelection();
let range = sel.getRangeAt(0);
let boundary = range.getBoundingClientRect();
function getRep(ar) {
res = [];
ar.forEach(el => {
el.forEach(a => {
res[a] = res[a] ? res[a]+1 : 1;
});
});
out = [];
res.forEach((el, i) => {if (el == ar.length) out.push(i);});
return out;
}
getRep([[1,2,3,4], [1,3,6,9], [1,3,9,10]]); // [1, 3]