Javascript

Semantic Versioning with npm

October 13, 2023

Semantic Versioning, often referred to as SemVer, is a crucial convention within the Node.


Read More

Understanding Peer Dependencies in Node Modules

October 12, 2023

When working with Node.js and managing packages for your projects, you’re likely familiar with the dependencies and devDependencies sections in a package.


Read More

Programming Languages Series

October 2, 2023

1. Introduction Welcome to our Programming Languages Series! In this series, we’ll explore various programming languages, understand their purposes, provide code examples, and discuss when to use each one.


Read More

React State Balancing: A Guide to State Management

August 11, 2023

As React apps grow, managing shared and app-wide state can become challenging.


Read More

React + Node: Beginner's Guide to Full Stack Dev

August 10, 2023

React excels at building fast, dynamic frontends. Node.js shines for server-side APIs and microservices.


Read More

Optimal React Patterns: Beginner's Guide

August 9, 2023

As with any framework, React comes with its own set of best practices and optimal patterns.


Read More

Debugging React Apps: Beginner's Guide

August 8, 2023

Bugs are inevitable in complex React applications. Thankfully, React provides great tools to squash bugs quickly.


Read More

Advanced React Patterns: Compound Components & More

August 7, 2023

As React apps scale, you’ll want to structure components for greater reusability and composability.


Read More

React Animation Guide: Libraries and Techniques

August 6, 2023

Animation brings interfaces to life. Thankfully, React has great open source libraries for animation.


Read More

Testing React Apps: Beginner's Guide to TDD

August 5, 2023

Testing is crucial for ensuring React apps are stable and bug-free.


Read More

Data Fetched Fast - A Beginner's Guide to React Query

August 4, 2023

Fetching data in React often means using stale state and complex caching logic.


Read More

Forms Simplified, A Beginner's Guide to Managing React Forms

August 3, 2023

Forms are a common need for many React apps. However, managing form state and validation can be tricky.


Read More

Optimizing React Performance: Beginner's Guide

August 2, 2023

As React apps grow, you may notice performance starting to lag - sluggish interactions, choppy animations, janky scrolling.


Read More

State Management 101 - A Beginner's Guide to React State

August 1, 2023

State management is a crucial concept in React. State allows components to dynamically update UI based on data changes.


Read More

Accessible React Apps: Beginner's Guide to Accessibility

July 31, 2023

Accessibility is an important consideration when building modern web apps. React provides useful tools to make accessible, inclusive products.


Read More

Mystery Boxes - A Beginner's Guide to React Fragments

July 30, 2023

When returning multiple elements from a component’s render method, they must be wrapped in a single parent DOM node:


Read More

Unidirectional Data Flow in React: Beginner's Guide

July 29, 2023

A key advantage of React is its unidirectional data flow. This makes the flow of data predictable, and helps avoid unexpected side effects from data changing unexpectedly.


Read More

Event Handling in React: Beginner's Guide

July 28, 2023

Responding to user events is a crucial part of building interactive UIs.


Read More

Hooked on React - A Beginner's Guide to React Hooks

July 27, 2023

When React was first released, class components were the standard way to build complex UIs.


Read More

Lifting State in React: Beginner's Guide

July 26, 2023

As React apps grow in complexity, managing shared state between components can become tricky.


Read More

Looping in JSX with React Keys: Beginner's Guide

July 25, 2023

Looping over arrays to render lists of elements is a common need in React apps.


Read More

Conditional Rendering in React

July 24, 2023

In React apps, you’ll often need to render different UI components conditionally based on certain state.


Read More

Passing Data Between React Components with Props

July 23, 2023

One of React’s core concepts is reusability through composable components. Components allow splitting complex UI into separate, reusable pieces.


Read More

How to Download a File in NodeJS without any Third Party Libraries

October 26, 2022

If you need to download a file in NodeJS without using any third party libraries, then you can do the following.


Read More

How to Execute a Shell Script in NodeJS

October 25, 2022

If you need to execute a shell script in NodeJS, then you can use the exec keyword.


Read More

How to Convert Milliseconds to Date in Javascript

October 14, 2022

If you need to convert Milliseconds to Date in Javascript, then you can do the following:


Read More

How to Convert String to Title Case in Javascript

October 13, 2022

If you need to convert a String to Title Case in Javascript, then you can do one of the following:


Read More

How to Deploy React App to S3 and CloudFront

August 22, 2022

If you would like to deploy a React App to AWS S3 and AWS CloudFront, then you can follow this guide.


Read More

[Solved] export ‘Switch’ (imported as ‘Switch’) was not found in ‘react-router-dom’

August 21, 2022

In react-router-dom v6, Switch is replaced by routes Routes. You need to update the import from:


Read More

How to get all checked checkboxes in Javascript

July 26, 2022

If you need to get all the checked checkboxes using Javascript, then you can do the following:


Read More

How to Create a Hashtag Generator in Javascript

July 23, 2022

If you want to create a hashtag generator in Javascript, then you can do the following:


Read More

How to Confirm before Leaving Page in Javascript

July 22, 2022

You can implement a function to be called before the user leaves a page with Javascript as follows:


Read More

How to Style an Element using Javascript

July 15, 2022

If you need to style an element using Javascript then you can use the style object to support all your CSS needs.


Read More

How to Wait 1 Second in Javascript

July 14, 2022

If you need your Javascript code to wait one (1) second (or more) while executing, then there are a couple of ways to achieve this.


Read More

How to use forEach method in Javascript

July 13, 2022

Arrays come with a useful forEach function that allows you to loop through the array.


Read More

How to Remove an Element from an Array in Javascript

July 12, 2022

If you need to remove an element from an array in Javascript, then you can use one of the following five (5) options:


Read More

How to get the Alphabet as Array in Javascript

July 11, 2022

If you need to get an array of alphabetical letters in Javascript then you can use one of the following:


Read More

How to get the Screen Width in Javascript

July 9, 2022

Javascript gives a few options to determine the screen width.


Read More

How to Reset Udemy Progress

June 12, 2022

If you need to redo a Udemy course and you would like to reset the course’s progress, then you can use the following Javascript snippet below.


Read More

How to Sort an Array of Objects by Property in Javascript

June 6, 2022

If you need to sort an array of objects by their property values using Javascript, then you don’t need to look further than the built-in sort functionality.


Read More

[Solved] npm ERR! could not determine executable to run

May 21, 2022

If you get the following message, then there’s a very easy fix:


Read More

[Solved] npm ERR! path node_modules/node-sass

May 20, 2022

If you get the following error and need a solution, then look no further!


Read More

How to Install Lodash through Yarn for React

May 19, 2022

You can install lodash through yarn as follows: Step 1 – Install Lodash to get the Library yarn add lodash Step 2 – Get the Typescript info yarn add --dev @types/lodash


Read More

How to update each dependency in package.json to the latest version

May 11, 2022

You have 2 options: Option 1 – Recommended (Using npx) npx npm-check-updates -u npm install Option 2 – Older way (Using npm globally) npm i -g npm-check-updates ncu -u npm install


Read More

How to Convert IPv4 to int32 in Javascript

May 10, 2022

The challenge Take the following IPv4 address: 128.32.10.1 This address has 4 octets where each octet is a single byte (or 8 bits).


Read More

How to Solve the Grouped by Commas Challenge in Javascript

May 9, 2022

The challenge Finish the solution so that it takes an input n (integer) and returns a string that is the decimal representation of the number grouped by commas after every 3 digits.


Read More

How to Create a Pyramid Array in Javascript

May 6, 2022

The challenge Write a function that when given a number >= 0, returns an Array of ascending length subarrays.


Read More

How to Create a Reverse Polish Notation Calculator in Javascript

May 5, 2022

The challenge Your job is to create a calculator which evaluates expressions in Reverse Polish notation.


Read More

How to declare a global variable in React?

May 4, 2022

If you need to declare a global variable in React, then you can do the following:


Read More

How to Find the Missing Term in an Arithmetic Progression in Javascript

May 3, 2022

The challenge An Arithmetic Progression is defined as one in which there is a constant difference between the consecutive terms of a given series of numbers.


Read More

How to Count Characters in a Javascript String

May 2, 2022

The challenge The main idea is to count all the occurring characters in a string.


Read More

How to Increment/Decrement a value in React/NextJS

May 1, 2022

Use the following code block to get started: function GetCount() { const [count, setCount] = useState(1); const incrementCounter = () => { setCount(count+1) } const decrementCounter = () => { if (count>1) setCount(count-1) } return <div className="_counterWrapper"> <span className="_dec" onClick={() => decrementCounter()}>-</span> <span className="_val">{count}</span> <span className="_inc" onClick={() => incrementCounter()}>+</span> </div> } Then in your HTML code, add it like this:


Read More

Fixing: ImmutableService requires getRowNodeId() callback to be implemented, your row data need IDs

June 13, 2021

If you have gotten this error before, then you have been trying to implement a rowData mapping onto Ag-Grid.


Read More

Automatically Resize All Columns to Fit in Ag-Grid

June 6, 2021

If you have an Ag-Grid, and want to automatically resize all the columns to fit the width of the viewport, you can use this hack.


Read More

How to Get All Rows in Ag-Grid

June 5, 2021

The easiest way to get the content of all rows’ data, back into a Javascript/Typescript array, is as follows.


Read More

How to Download a CSV file using Javascript

April 29, 2021

Ever wanted to generate a CSV (comma separated values) file directly from the browser, using Javascript?


Read More

How to Format Numbers by Prepending 0 to single-digit numbers in Javascript

December 14, 2020

If you have a single-digit number, and you need to format it to always have at-least two digits, then you can use the below function to solve your problem:


Read More

Validate Email Address in Javascript

June 7, 2020

Below is a nice little Javascript RegularExpression to validate email addresses.


Read More

Remove hash from window.location in Javascript

June 6, 2020

E.g. URL:<br>http://example.com/?option=1&task=2&listing_id=36&layout=4&table=5#some_hash_value_here So how would you get the current URL using Javascript?


Read More

How to use Google Analytics in AngularJS

May 20, 2020

It seems to be quite a popular question with not as many answers to hold the weight.


Read More

Comparing Java and Javascript

May 4, 2020

Perhaps the first thing that most people ask when they hear the names of these two programming languages are.


Read More

Convert URL String into a Javascript Object

April 29, 2020

Sometimes you find yourself with a String, something like and you want to repeatably access elements of it correctly.


Read More

How to fix a Javascript Uncaught ReferenceError

April 27, 2020

Sometimes you may get an error that looks something like this:


Read More

uncaught typeerror: $ is not a function

April 12, 2020

The dollar-sign ($) in Javascript has for many years now been associated with jQuery.


Read More

Another WTF Javascript Moment

April 1, 2020

Javascript is a powerful language, but sometimes it doesn’t always do what you expect it to.


Read More

How to Format a Number as a Currency in Javascript

March 21, 2020

There are quite a few ways to format a number as a currency value in Javascript.


Read More

How to Host an AngularJS site on AWS S3

March 18, 2020

AngularJS is a Javascript Framework that allows you to create dynamic front-end web applications easily.


Read More

Generate a random number between two numbers in JavaScript

March 16, 2020

If you need to generate a random number between two numbers in JavaScript, then you are in the right place!


Read More

How to tell if a String contains a Substring in Javascript

February 29, 2020

Javascript comes with some pretty good support for determining if a string contains a substring.


Read More

How to write Anonymous Functions in Javascript

February 26, 2020

There is a lot of power in Javascript syntax. One of those powerful things is that of Javascript Anonymous Functions.


Read More

What is Fizz Buzz?

February 23, 2020

Fizz buzz is a common programming interview question. The problem statement usually reads something like this:


Read More

How to safely parse JSON in Javascript

February 15, 2020

JSON stands for Javascript Object Notation and has become wildly popular to transport and store data between application, databases and more.


Read More

Check if an HTML Checkbox is checked using Javascript

February 14, 2020

While processing forms in web development, it’s a common requirement to be able to tell if a checkbox has been checked or not.


Read More

How to Merge Javascript Objects

February 11, 2020

A Javascript Object – now just called JSON – is a collection of values and properties stored as a map.


Read More

Introduction to NPM

February 6, 2020

What is NPM? NPM stands for Node Package Manager, and is the default way to extend your Node applications.


Read More

How to replace all occurrences of a string in Javascript

January 31, 2020

I have pretty much resigned myself to the fact that in Javascript, there are really only two ways to do a proper search and replace.


Read More

Keep Google Map v3 centered when browser is resized

March 8, 2013

Using Google Maps V3 Javascript API you can keep the map centered to the browser’s window by using the following trick when resizing the window.


Read More

jQuery limit fields to alphanumeric characters only

September 26, 2012

I was trying to restrict a form’s field from only allowing the user to enter alphanumeric characters into it.


Read More

Disable Cache in jQuery

May 24, 2012

I usually run into this problem when dealing with good ol’ Internet Explorer (.


Read More

How to break out of an iframe

May 9, 2012

So someone’s trying to make their site better by opening a page on your site inside of their site using an iframe?


Read More

jQuery Colorbox not showing but background shows

November 8, 2011

I was using Colorbox for some lightbox type effects to show larger images when clicking on thumbnails, but for some reason the background was showing up but the pretty little box in the middle where the larger image is supposed to show never showed up, so this is how I made it finally appear after many failed attempts!


Read More

Get Value of Checkbox using jQuery

October 25, 2011

This one is quite an easy one, but a good one to mention non-the-less as it does definitely come in really handy.


Read More

Ternary Operation

October 12, 2010

If you do not know what the Ternary operator is, or do not use it while you are coding, let me be the first to tell you how much you are missing out!


Read More

IE6 PngFix in Javascript

September 2, 2010

As a web developer you will know just how much we all love hate Internet Explorer 6 – one of the most dreaded browsers and browser versions that still exists in the deep dark corners of the interwebs – and you will probably have figured out that it doesn’t play well with PNG images.


Read More

How to get ‘how many days in February’ using Javascript?

May 19, 2010

It is quite handy to have a function that can tell you how many days there are in February due to the leap year shift of either 28 or 29 days.


Read More

Search and Replace Anchor Href using Javascript

April 29, 2010

I have a site that is under development and it was made really badly so I needed a quick way to replace all anchors on page to the relevant path.


Read More

Swap HTML Elements Using Javascript

April 26, 2010

It is quite easy to use javascript to swap between divs or any other html dom elements.


Read More

[Exception… “Could not convert JavaScript” nsresult: “0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)”

March 30, 2010

What the heck is.. uncaught exception: [Exception… “Could not convert JavaScript argument arg 0 [nsIDOMHTMLDivElement.


Read More

Firefox error in FeedProcessor.js

January 6, 2010

[Exception… “Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIChannel.contentType]” nsresult: “0x80040111 (NS_ERROR_NOT_AVAILABLE)” location: “JS frame :: file:///C:/Program%20Files/Mozilla%20Firefox/components/FeedProcessor.


Read More

TypeError: node is null message=node is null

October 20, 2009

The following error message occurs in Firefox 3 when using Firebug.


Read More

How to Temporarily Edit the Text of Any Website

October 20, 2009

Have you ever wanted to temporarily edit a webpage displayed in Chrome or another browser?


Read More

Sending data from javascript to php

October 20, 2009

If you ever find yourself needing to do some ajax and in turn sending strings of characters via javascript then you should really try encodeURIComponent() to wrap your strings in.


Read More

What is Eb in firebug?

October 20, 2009

Gmail produces the following error/warning in firebug. Eb is not defined


Read More

Add TinyMCE code button

October 20, 2009

I had quite a few problems adding the htmlCode button to a fairly old copy of TinyMCE (I think around version 2.


Read More