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 ‘minify’ Javascript code

DIY Minification No minifier can compress properly a bad code. In this example i just wanna show how much a minifier does. What you should do before you minify And regarding jQuery… i don’t use jQuery.jQuery is for old browsers,it was made for compatibility reasons .. check caniuse.com, almost everything works on every browser (also … 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

What is javascript runtime..?

Maybe it’s referring to Google’s V8 engine. It is an engine for processing JavaScript in the browser and is used by Google Chrome. It’s open source. And it’s written in C++. It works on several platforms including mobile and embedded devices. For more information see: https://code.google.com/p/v8/ If you google for “chrome javascript runtime“, you will get all these … Read more