How to declare a global variable in React?
If you need to declare a global variable in React, then you can do the following:
Create a file called config.js
module.exports = global.config = { …
Read Article →
94 articles about javascript development, tools, and best practices
If you need to declare a global variable in React, then you can do the following:
Create a file called config.js
module.exports = global.config = { …
Read Article →
An Arithmetic Progression is defined as one in which there is a constant difference between the consecutive terms of a given series of …
Read Article →The main idea is to count all the occurring characters in a string. If you have a string like aba, then the result should be {'a': 2, …
Use the following code block to get started:
function GetCount() {
const [count, setCount] = useState(1);
const incrementCounter = () => { …
Read Article →
If you have gotten this error before, then you have been trying to implement a rowData mapping onto Ag-Grid.. and failed!
ImmutableService requires …
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.
The easiest way to get the content of all rows’ data, back into a Javascript/Typescript array, is as follows.
Simply create a blank array, then …
Read Article →Ever wanted to generate a CSV (comma separated values) file directly from the browser, using Javascript? Instead of going to the server..
Look no …
Read Article →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 …
Read Article →Below is a nice little Javascript RegularExpression to validate email addresses.
/^\w.+@[a-zA-Z_.]+?\.[a-zA-Z.]{2,3}$/
..and to use it..
if …
Read Article →
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 …
Read Article →It seems to be quite a popular question with not as many answers to hold the weight.
Google Analytics has always been more of a pageviews type …
Read Article →Perhaps the first thing that most people ask when they hear the names of these two programming languages are. “Why do they have the same …
Read Article →Sometimes you find yourself with a String, something like and you want to repeatably access elements of it correctly.
Let’s say that you want …
Read Article →Sometimes you may get an error that looks something like this:
Uncaught ReferenceError: <some_variable_or_function> is not defined
At first this …
Read Article →The dollar-sign ($) in Javascript has for many years now been associated with jQuery.
When you see this error:
“uncaught typeerror: $ is not a …
Read Article →Javascript is a powerful language, but sometimes it doesn’t always do what you expect it to.
Take the following expression for example. …
Read Article →There are quite a few ways to format a number as a currency value in Javascript. This is a common task when building web applications, similar to …
Read Article →AngularJS is a Javascript Framework that allows you to create dynamic front-end web applications easily.
I have traditionally packaged these …
Read Article →If you need to generate a random number between two numbers in JavaScript, then you are in the right place! Here you will learn javascript random …
Read Article →Javascript comes with some pretty good support for determining if a string contains a substring.
There is the newer includes function which was …
There is a lot of power in Javascript syntax. One of those powerful things is that of Javascript Anonymous Functions.
But what is an Anonymous …
Read Article →Fizz buzz is a common programming interview question.
The problem statement usually reads something like this:
Read Article →Write a short program that …
JSON stands for Javascript Object Notation and has become wildly popular to transport and store data between application, databases and more.
However, …
Read Article →