- for (var i in response) {
- if (response.hasOwnProperty(i) && response[i].command && this.commands[response[i].command]) {
- this.commands[response[i].command](this, response[i], status);
+ var _this = this;
+
+ Object.keys(response || {}).forEach(function (i) {
+ if (response[i].command && _this.commands[response[i].command]) {
+ _this.commands[response[i].command](_this, response[i], status);