How-to articles, tricks, and solutions about JAVASCRIPT

How to Convert a Unix Timestamp to Time in JavaScript

Read the tutorial and find how you can convert the UNIX timestamp to time in JavaScript to make the Unix format date-time value in a user-readable format.

How to Declare Constants in JavaScript?

Read this tutorial and learn useful information about declaring a constant by using the const keyword which creates a read-only reference to the value.

How to Add a Class to a Given Element

Read the tutorial and learn the two suggested methods of creating a JavaScript function that will add a class to the <div> element and solve your problem.

How to Create a Two Dimensional Array in JavaScript

The two-dimensional array is an array of arrays. Read this JavaScript tutorial and find out several methods of creating two dimensional arrays easily.

How to Get URL Parameters

Read this JavaScript tutorial and learn how you can easily get the URL parameters with the help of the methods provided by the URLSearchParams interface.

How to Check if a Value is an Object in JavaScript

Checking the data type of the value can be misleading. Read this tutorial and learn which operator is used to check if a value is an object in JavaScript.

The “right” JSON Date Format

Read the tutorial and learn the right methods of JSON date formatting with the help of JavaScript. Get to know information about ISO 8601 string format.

How to Convert JavaScript String to be All Lowercase and Vice Versa

Read this tutorial and learn the way of making a JavaScript string all lowercase and uppercase with the help of toLowerCase() and toUpperCase() functions.

How to Change the Href for a Hyperlink using jQuery

Read this JavaScript tutorial and learn the easy way of changing the href attribute for a hyperlink step by step by using one of the methods of jQuery.

How to Merge Two Arrays in JavaScript and De-duplicate Items

Read this tutorial and find useful information about the simplest methods that are used for merging two arrays and removing duplicate items in JavaScript.

How to Generate a Random Number Between Two Numbers in JavaScript

It is frequently necessary to generate a random number between two numbers while working with JavaScript. This snippet will help you to do it efficiently.

How to Display a JavaScript Object

Sometimes it is necessary to display a JavaScript object. With the help of the given tutorial, you will find the best solutions to displaying an object.

How to Count the Number if Keys/Properties of a JavaScript object

It is frequently necessary to count the number of keys/properties of an object in JavaScript. Find several solutions to that issue in this short tutorial.

How to Scroll to the Top of the Page Using JavaScript

Read this tutorial and find useful information about the simplest native JavaScript method and its parameters to make the page jump on the top instantly.

Is JavaScript a Pass-by-reference or Pass-by-value language?

On this page, we will look into pass-by-reference and pass-by-value. Let’s explore their differences and find out what language JavaScript is considered.

How to Check if an Object has a Specific Property in JavaScript

Read this tutorial and learn the methods of checking whether the specified object has the specified property in JavaScript. Find the fastest one for you.

What is the “new” Keyword in JavaScript

Here, you will find a quick overview of the “new” keyword in JavaScript. You need to understand it properly for the more effective usage of JavaScript.

When to Use Double or Single Quotes in JavaScript

Almost all JavaScript developers come across the issue: when to use double or single quotes. Here, we explore possible cases, offering rational solutions.

How to Get the Children of the $(this) Selector

Getting the children of the $(this) selector is one of the common issues in modern JavaScript. Find the most proper answer to the problem in this snippet.

How to Convert Decimal to Hexadecimal in JavaScript

Read this tutorial and find the easiest way of converting the decimal number to hexadecimal in JavaScript. Also, find information about the number systems.

How to Add Options to a Select Element using jQuery

Read this tutorial and find useful information about the multiple methods of adding options to a select element using jQuery. Choose the best one for you.

How to Format Numbers as Currency String

This tutorial provides useful information about the formatting number as currency strings. Read and learn several methods you can use to solve your problem.

How to Empty an Array in JavaScript

This tutorial provides useful information about clearing an existing array in JavaScript. Get familiar to multiple methods and find the best one for you.

What is JavaScript Version of Sleep()

The tutorial provides information about JavaScript version of the sleep() which makes the function pause execution for specified seconds of milliseconds.

How to Get the Current Date and Time in JavaScript

The tutorial provides information of getting the current date, time and both by running a simple piece of code. Also, get the full explanation of the code.