Having different favicons for your development and production environments can be extremely useful: you can see in a split second if you are working on the right tab in your browser. If you already refreshed, refreshed and refreshed again a page for 5 minutes… wondering why your changes don’t show up, and realizing that you were refreshing the live website instead of the local one, raise your hand ✋. This won’t happen anymore with this quick JavaScript hack to display a different favicon depending on your environment. 1. Create two different favicon images 👉 Note: a favicon image should be … Continue reading Different Favicon for Dev and Prod
Tag Archives: JavaScript
JavaScript console.log: Next Level Debugging
If you are working in web development, you have probably encountered JavaScript at some point. As the following chart shows, it has been a dominating language for many years now, and still holds a strong position, probably due to the large number of frameworks using it (Angular, Backbone, Node, React, Vue.. to name a few). Then you are probably familiar with the famous logging method: console.log(). But, are you using it to its full potential ? Here is a glimpse of a few powerful hacks to debug JavaScript. Logging Objects Let’s dive directly into the core of the console with … Continue reading JavaScript console.log: Next Level Debugging
How to get an Element Starting with Class Name: the * and ^ JavaScript Selectors
You certainly know * and ^ as selectors in different programming languages. But you may have found some surprising (or frustrating) results while using them as JavaScript or jQuery selectors. Let’s say you want to access elements starting with a certain class name, for example, “fruit-“ in the following code: First, the syntax Your first reflex may be to try something like that: The correct syntax is: Then, the selectors: ^ vs * Using the ^ selector is correct, but its behavior is a bit too literal: it will get the very first element starting with the class name, or … Continue reading How to get an Element Starting with Class Name: the * and ^ JavaScript Selectors