Tuesday, June 18, 2024
JavaScript provides several ways to handle conditional logic. One powerful method is the logical AND (&&) operator. This tutorial will…
Wednesday, July 12, 2023
Arrays Chunk Creates an array of elements split into groups the length of size. Compact Creates an array with all…
Monday, August 29, 2022
JavaScript golfing is the process of writing the smallest amount of JavaScript code to do something awesome.
Tuesday, August 9, 2022
JavaScript strings are deceptively complex constructs. There are actually two different types of strings – string Literals and string Objects…
Monday, July 4, 2022
This JavaScript code snippet adds inline validation to any form field (input, select and textarea). Feel free to customise it…
Tuesday, May 17, 2022
Here’s a quick snippet to preload the next step in a theoretical funnel/workflow: PHP JavaScript Like0
Tuesday, December 27, 2022
This is a quick reminder on how to use mathematical functions inside JavaScript. Instructions Trig: sin, cos, tan, cot, sec,…
Tuesday, May 17, 2022
I needed some structural updates for a site, and among them, I added some JavaScript snippets. I will show you…
Wednesday, April 30, 2025
A JavaScript global variable is a variable with global scope, meaning that it is visible and accessible throughout the program, unless…
Friday, June 3, 2022
This JavaScript will let you execute code a certain number of times. For example, you might want to only show…
Friday, June 3, 2022
Here’s a neat trick if you’re into micro-optimization. JavaScript compressors and minifiers are used to make JavaScript code smaller and,…
Thursday, January 30, 2025
I don’t use 🍪 cookies any more, I think they are too… rigid. I use localStorage items. By default, they…
Monday, May 16, 2022
This JavaScript snippet will extract a price from a DOM element, remove all alphanumeric characters, such as currency or symbols…
Tuesday, May 17, 2022
There’s an increasing trend of adding full-width (possibly full-height) YouTube video covers with autoplay. Using the YouTube Iframe API, this…
Monday, May 16, 2022
This is an old script, which helped a lot with the initial phase launching a project on all browsers and…
Monday, May 16, 2022
You definitely don’t need a plugin for this. Although there are plugins which help with creating a service worker and…
Monday, May 16, 2022
Here’s a cross-browser compatible way of getting query parameter from a URL or setting query parameters and reloading the page. An…
Monday, May 16, 2022
The latest Chrome version has stopped video autoplay if the video is not muted. Firefox and the other browsers will soon…
Monday, June 12, 2023
Every variable in JavaScript has a data type which dictates the values that can be stored in it. However, JavaScript…
Monday, May 16, 2022
The basic idea to make this comparison would be to get arrays of parts from the version numbers and then compare pairs…
Monday, May 16, 2022
This is a function to remove all double whitespaces and preceding line breaks. This is a function to replace all line…
Monday, May 16, 2022
In JavaScript, any variable can be used in a logical context, such as the condition of an if statement or…
Wednesday, June 15, 2022
Writing code in an async programming framework like node.js becomes super complex and unbearably ugly, superfast. You are dealing with…
Monday, February 27, 2023
Events are the bread and butter in UI development. They are frequently used to kick off JavaScript to deal with…
Tuesday, May 10, 2022
Most of the JavaScript libraries come wrapped in an easy to refer single object. The object acts as a namespace,…
Tuesday, May 10, 2022
I recently fully understood the concept of utilizing Currying in JavaScript. The core concept can be grasped from these references: Wikipedia entry on…
Wednesday, April 30, 2025
John Resig, the creator of jQuery, has created this JavaScript inheritance code. I am still using it now to simplify several…
Tuesday, May 10, 2022
In JavaScript OOP there are attributes called private attributes. Knowing if an attribute is private or public, an API user…
Wednesday, April 30, 2025
When it comes to developing APIs, self-documenting code is very important, as it simplifies the user’s effort in filtering the…
Tuesday, May 10, 2022
JavaScript has a dynamic object named this. By default, this equals to the global object container, so if we have…
Tuesday, May 10, 2022
setTimeout() is a great help to many JavaScript developers. For example, you may wish to add a delay to allow…
Wednesday, April 30, 2025
This small JavaScript prototypes enhance the trim() function and allow for better trimming and/or replacing line breaks with commas (or…
Tuesday, May 17, 2022
This tutorial is about JavaScript popups and how to show a window in the center of the screen and focus on it.…