of course it somewhat depends on how modern it may be. e.g. Mozilla supports
Iterators, which is (from the sound of it) best suited. however, it can also be done in plain old JS.
PHP Code:
// only tested in FF
var it = Iterator([
{jp: "食べる", en: "eat"},
{jp: "読む", en: "read"},
{jp: "行く", en: "walk"},
]);
var loop = function()
{
try {
var obj = it.next()[1];
this.textContent = obj.en + " => " + obj.jp;
}
catch (e) {
alert("end of iteration");
}
}
// attached to a button
document.getElementById("test").addEventListener("click", loop, true);