const arr = [
[0, 0, 0],
[1, 0, 49],
[2, 50, 149],
[3, 150, 349],
[4, 350, 849],
[5, 850, 1849],
[6, 1850, 3849],
[7, 3850, 5849],
[8, 5850, 9849],
[9, 9850, 15849],
[10, 15850, 23849]
];
const getNum = function(num) {
let result = arr.reduce((acc, item) => {
for(let i = 0; i<= 2; i++) {
if(num >= item[1] && num <= item[2] ) {
return acc = item[0];
}
}
return acc;
}, 0)
return result;
}
console.log(getNum(30))
function liki() {
const ids = [...document.querySelectorAll('#user uidm')].map(uidm => uidm.attributes.uid.value);
const idss = [...document.querySelectorAll('#user uid')].map(uid => uid.attributes.uid.value);
if (ids.length > 0 && idss.length > 0) {
status = 'on'
}else {
status ='off'
}
if(status==='on') {
start();
}
}
setInterval(liki,100);
let timer = 1000;
let timenull = null;
function start() {
if (!timenull) {
console.log('запущенно')
}
clearTimeout(timenull);
timenull = setTimeout(stop, timer);
}
function stop() {
timenull = null;
console.log('Не запущенно');
}
SELECT sex, room, COUNT(*) as count
FROM `User`
WHERE `room` > 999 AND (`sex`= 1 OR `sex` = 2)
GROUP BY `sex`, `room`
HAVING if(`sex` = $user1->sex, count < 8, count < 4)