Ankit Kumar

Ankit Kumar

  • NA
  • 159
  • 48.6k

Problem With Set Interval

Feb 27 2016 1:10 AM
hi all,
 
i am trying to display the values of javascript array,but i am unable to control it.
 
below is code how could i achieve my task that it should not run after setting the value of i more than 4
 
var title = ['Orange', 'Apple', 'Mango', 'Airplane', 'Kiwi'];
var i = 0;
setInterval(function()
{
document.write(title[i++]);
}, 1000)
 

Answers (2)