Javascript:在图像中循环

Javascript:在图像中循环,javascript,jquery,html,Javascript,Jquery,Html,我有一组图像,我想无限循环,但我似乎无法理解逻辑,这是我的尝试: var-imagesArray=[”http://vignette2.wikia.nocookie.net/pokemon/images/e/ef/025Pikachu_Pokemon_Mystery_Dungeon_Red_and_Blue_Rescue_Teams.png/revision/latest?cb=20150105233050", "http://assets.pokemon.com/assets/cms2/i

我有一组图像,我想无限循环,但我似乎无法理解逻辑,这是我的尝试:

var-imagesArray=[”http://vignette2.wikia.nocookie.net/pokemon/images/e/ef/025Pikachu_Pokemon_Mystery_Dungeon_Red_and_Blue_Rescue_Teams.png/revision/latest?cb=20150105233050",
"http://assets.pokemon.com/assets/cms2/img/pokedex/full//007.png",
"http://assets.pokemon.com/assets/cms2/img/pokedex/full/001.png",
"http://www.pokemonxy.com/_ui/img/_en/art/Fennekin-Pokemon-X-and-Y.jpg",
"http://www.pokemon20.com/assets/img/mythical/arceus/poke_arceus.png"];
var计数=0;
var loopImages=函数(计数){
$('#firstStar').fadeIn(1500,function(){
如果(计数=0){
$('img').attr('src',imagesArray[1]);
}
$('firstStar')。延迟(4000)。淡出(1500,循环图像(计数));
});
计数++;
log('结束计数:'+计数);
}
循环图像(计数)//步骤1:启动循环,传递计数,从0开始

我对代码进行了编辑,使其正常工作:


特别是,请参阅运算符和函数的用法。

您需要检查运算符…数组在JSWow中基于0,非常有帮助的家伙,谢谢,我肯定用这些注释解决了我的答案非常感谢,我将对此进行研究。皮特-你如何避免递归调用上的堆栈溢出?@akaphenom:D…当然,通过使用循环而不是递归。但是,嘿,毕竟,这是stackoverflow。com@akaphenom如果有人看口袋妖怪很多年(1999314903.0690?),也会有一个整数溢出。是的,但我喜欢模-它减轻了愚蠢的(count==array.length)count=0位