how to check if window size of browser s changed javascript

JavaScript
$(window).resize(function() {
  console.log('window was resized');
});
Source

Also in JavaScript: