A simple js array iterator