I wanted to write a function that allowed me to wait for a specific time to run the code. The quick and dirty way to do it was to use setTimeout and nest callbacks. For example, at the end of an ...
https://idiallo.com/javascript/delay-callbacks-and-promises?src=feed
I find it very annoying when I use an instant search field and each key I press creates a new state. What this means every single time I hit the back button, it removes a single key from the URL....
https://idiallo.com/javascript/pushstate-the-proper-way?src=feed
At some point, every web application needs an overlay. A sort of pop-up that obscures the background and asks the user to perform an action. Here is how you do it. First you create the HTML, gi...
https://idiallo.com/javascript/create-dom-elements-faster?src=feed
TL;DR; You are accessing a property of an object that is null. For example, document.getElementById('stuff') returns null. So adding .value will cause the error. You are trying to access a DOM ...
https://idiallo.com/javascript/uncaught-typeerror-cannot-read-property-of-null?src=feed
There is a clear reason why you should use prototypes when creating classes in JavaScript. > THEY USE LESS MEMORY. When a method is defined using this.methodName a new copy is created ever...
In JavaScript, like in many other languages a loop can be defined in many ways. The standard of course is the for-loop, the while loop, or do while loop. They are all natively implemented in Java...
https://idiallo.com/javascript/minimize-lookups-in-for-loops?src=feed
This is a common error in JavaScript, and it is hard to understand at first why it happens. But if you bear with me and remember that Bugs are a good thing you will be on your way in no time. ...
https://idiallo.com/javascript/uncaught-syntaxerror-unexpected-token?src=feed
JavaScript live collection is a subject that is rarely talked about. Earlier I had written about a caveat when using them . It did help people but one of the problem is that most didn't understan...
https://idiallo.com/javascript/magical-js-html-live-collection?src=feed
It comes to a surprise that JavaScript, the most popular language on the web, has the most unconventional method for creating a class. In most object oriented programming languages, classes follo...
https://idiallo.com/javascript/creating-a-class-in-js?src=feed
In JavaScript, everything is an object. This is amazing because you never have to ask yourself if something is an object. The answer is always YES. Let's look at a few examples: // a number ...
https://idiallo.com/javascript/object-hasown-property-use-case-example?src=feed