I apologise if this is a duplicate. Im a little confused as to what the difference is with this
$('.child_panel').on('click', () => {
console.log(this);
});
and with this
$('.child_panel').on('click', function() {
console.log(this);
});
To it seems that the binding to of the context to this
is only occurring in the second case and not the first. Can someone please explain what the difference is and what the proper way to do it would be in the case of the arrow function.
Thanks!