JavaScript inheritance and iteration utilities