let counterInerval
let changeSmallMenuItem = function () {
let counter = 1;
const elemLength = $('.small-menu__item').length - 1;
if (counter === elemLength.length) {
console.log('counter finish');
} else {
counterInerval = setInterval(() => {
if (counter === elemLength.length) {
console.log('counter finish');
} else {
console.log(counter++);
}
}, 1000);
}
};
$('.small-menu a').hover(function () {
changeSmallMenuItem();
}, function () {
clearInterval(countInterval);
});