This could use Object.keys(newProperties).forEach(function(key) {...})