Stop using Array.forEach for everything! “for/of”, USE IT!

var company = {
name : 'Dunder Muffin',
employees : 'Pam', 'Jim', 'Andy', 'Kelly',
showEmployees : function() {
this.employees.forEach(
employee => console.log(this.name + ': ' + employee)
)
}
}
var company = {
name : 'Dunder Muffin',
employees : 'Pam', 'Jim', 'Andy', 'Kelly',
showEmployees : function() {
for (var employee of this.employees) {
console.log(this.name + ': ' + employee;
}
}
}
for (
var i = 0, employee;
employee = this.employee[i];
i++
) {
for (
var i = 0, employee;
undefined !== (employee = this.employee[i]);
i++
) {

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store