Searched for "javascript performance tips"
https://www.keycdn.com/blog/javascript-performance
Interesting points are
HTTP/2 uses multiplexing, therefore allowing multiple requests and responses to be sent at the same time.
Use a compression method such as Gzip or Brotli to reduce the size of your JavaScript files.
This thing:
var Person = Object.create({
init: function(name) {
this.name = name;
},
do: function(callback) {
callback.apply(this);
}
});
var bob = new Person('bob');
bob.do(function() {
alert(this.name); // 'bob' is alerted because 'this' was rewired
});
This thing, though I prefer to keep the necessary javascript right in the html:
// load example.js without interrupting your webpage's rendering
<script src="example.js" async></script>
// load example.js after the page has finished loading
<script src="example.js" defer></script>
Animate with requestAnimationFrame