I have this small function giving an error because i is undefined:
var i = 0
setInterval(function(i){
var i = ( i < $(".news-items li").length ) ? i++ : 0 ;
$(".news-items li").hide();
$(".news-items li:eq("+i+")").show();
}, 1000)
Can anyone spot the problem?
You’re redeclaring
ias a local variable in the anonymous function. Remove theiin the function’s parameter list.