Let's say I have this code:
const MyObject = {
a($els) {
// What is the best practice here ?
$els.each(function() {
MyObject.b($(this));
});
// Or
const self = this;
$els.each(function() {
self.b($(this));
});
},
b($el) {
$el.addClass('test');
}
};
What is the "best practice" for calling another method in the object? Is there any downside calling the variable "MyObject"? Or is it better to use this
and why?