var emitter = require('events').EventEmitter;
var util = require('util');
let Person = function (name) {
this.name = name;
};
util.inherits(Person, emitter);
let p = new Person("jonny");
p.on('speak', (said) => {
console.log(` ${this.name} said: ${said}`);
});
p.emit('speak', "You may delay but time will not!");
console will return
undefined said: You may delay but time will not!
if you change from lambda back
p.on('speak', function(said) {
console.log(` ${this.name} said: ${said}`);
});
it works. can some explain to me why this acts differently with syntactic sugar changes?