In JavaScript, is the following code:
window.onresize = function() {
// Do something.
}
The same as:
$(window).on('resize', function () {
// Do something.
});
Are the two code blocks above equal, functionality-wise? Is there any advantage or disadvantage (however minor) using one or the other?
What about:
window.addEventListener('resize', function(event) {
// Do something.
});