Answer the question
In order to leave comments, you need to log in
Why doesn't this example work (function substitution)?
Hey all!
The code:
var emit = server.emit;
/* Вариант 1 - работает */
server.emit = function(event) {
console.log('блабла');
return emit.apply(server, arguments);
};
/* Вариант 2 - НЕ работает */
server.emit = event => {
console.log('блабла'); // <-- это работает
return emit.apply(server, arguments); // <-- здесь не работает
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question