// ES6 solution const children = [...parent.getElementsByTagName('tag')]; children.forEach((child) => { /* Do something; */ });