I currently need to keep looping through an array using javascript. The below is the one-way I can think of but 1-it doesn't work and 2- was wondering if their is a more optimal or compact way of achieving this?
var myArray=[1,2,3,4]
for (var i=0; i<myArray.length; i++)
{
console.log(i + 'hi')
if (i==3)
{
i=0;
}
}