let i;
for( number >=0 ? i=1 : i=-1; number >=0 ? i<number : i>number; number >=0 ? i++ : i--)
/code>
const handlers = {
positive: (num, data) => {
for(let i = 1; i < num; i++) {
// обработка data
}
},
negative: (num, data) => {
for(let i = -1; i > num; i--) {
// обработка data
}
}
};
const handlerName = number >= 0 ? 'positive' : 'negative';
const handler = handlers[handlerName];
const processedData = handler(num, data);