As scope of this
becomes available in ES6
arrow functions.
but here is a case in which I am unable to access this
in the arrow function while it is working with normal anonymous function
Example
Sample 1
$(document).ready(function() {
$('.principal').click(() => {
alert($(this).parent().html()); // 'this' is undefined here
});
})
Sample 2
$(document).ready(function() {
$('.principal').click(function() {
alert($(this).parent().html()); // 'this' is available here
});
})