Use Object.prototype.forEach to replace the common for loop.