How do I modify the URL without reloading the page?

This can now be done in Chrome, Safari, Firefox 4+, and Internet Explorer 10pp4+! See this question’s answer for more information: Updating address bar with new URL without hash or reloading the page Example: You can then use window.onpopstate to detect the back/forward button navigation: For a more in-depth look at manipulating browser history, see this MDN … Read more

Javascript Comparison Operators != vs !==

Human readable text about their differences Using !== and === will do a more strict compare than ==/!=. The former will check if the objects being compared are of the same type, as well as if the values matches. Using == will make it possible for an implicit cast to be made, see the below examples. What does the standard say? 11.9.6 … Read more

How to measure time taken by a function to execute

Using performance.now(): In Node.js it is required to import the performance class importing performance Using console.time: (living standard) Note:The string being passed to the time() and timeEnd() methods must match(for the timer to finish as expected). console.time() documentations: MDN documentation Node.js documentation

How do I include a JavaScript file in another JavaScript file?

The old versions of JavaScript had no import, include, or require, so many different approaches to this problem have been developed. But since 2015 (ES6), JavaScript has had the ES6 modules standard to import modules in Node.js, which is also supported by most modern browsers. For compatibility with older browsers, build tools like Webpack and Rollup and/or transpilation tools like Babel can be used. … Read more

What does window.jQuery and window.$ mean?

I will pull from an article I linked to in a comment above: As discussed in the JavaScript Basics section, valid names in JavaScript can be pretty much anything, as long as they don’t begin with a number and don’t include a hyphen. So, the $ in the code above is just a shorter, more … Read more