How-to articles, tricks, and solutions about JAVASCRIPT

How to Create and Trigger Event in JavaScript

Read this tutorial and learn how you can create and dispatch the DOM Events in JavaScript. Also, learn to add custom data and trigger built-in events.

How to Create Fullscreen Overlay Navigation Menu

Read this tutorial and learn which two functions are used to create a fullscreen overlay navigation menu to make your website more beautiful and catchy.

How to Create Range Slider With HTML5 and jQuery

HTML5 range input type allows creating range sliders. Read the tutorial and learn a simple solution including a jQuery code to achieve the desired result!

How to Create Smooth Scrolling When Clicking an Anchor Link

Read the tutorial and learn information about the two jQuery and JavaScript solutions that are used to create smooth scrolling when clicking an anchor link.

How to Declare and Initialize an Array in JavaScript

Read this tutorial and learn the two basic methods of declaring and initializing an Array in JavaScript. Also, read about the differences of the methods.

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 Define Global Variable in a JavaScript Function

Read the tutorial and learn how to define a global variable in a JavaScript function. Also, read about the differences about the global and local variables.

How to Delete the First Character of a String in JavaScript

Read this tutorial and learn some useful information about the methods that are used for deleting the first character of a string in JavaScript easily.

How to Detect a Click Outside an Element

A common pattern used in JavaScript is detecting a click outside an element. This snippet offers you the most efficient ones among the various solutions.

How to Detect Escape Key Press Using jQuery

Read this tutorial and learn the two methods of detecting an escape key press using jQuery. Read about keyup and keydown event handler and see examples.

How to Detect Idle Time in JavaScript

Read this tutorial and learn useful information about the vanilla JavaScript and jQuery solutions that are used for detecting the idle time correctly.

How to Disable Text Selection, Copy, Cut, Paste and Right-click on a Web Page

Learn the ways of how to disable text selection highlighting, how to disable copy, cut and paste, how to disable right-click. See example with CSS, JavaScript and jQuery.

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 Display a Message if JavaScript is Turned Off

If you have a content that will not function without JavaScript, you need to display a message with an explanation of the problem. In this snippet, we are going to have a look at 2 simple methods to display the content when JavaScript is turned off.

How to Distinguish Between Left and Right Mouse Click with jQuery

In this tutorial, you will read and learn useful information about the fastest method of distinguishing between left and right mouse click with jQuery.

How to Do String Interpolation in JavaScript

Read this tutorial and learn the simplest method of doing a string interpolation in JavaScript. Also, read information about string literal and placeholder.

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.

How to Encode and Decode Strings with Base64 in JavaScript

Read this tutorial and learn useful information about two JavaScript built-in functions which are used to convert a string to and from base64 encoding.

How to Encode JavaScript Object to Query-String

Read this JavaScript tutorial and learn useful information about the two widely used methods that are used for encoding objects to query strings easily.

How to Encode JavaScript URL

In the tutorial, you can read and learn useful information about the two JavaScript functions that are used for encoding URL and their use cases in detail.

How to Execute a JavaScript Function when You have Its Name as a String

Read this tutorial and learn about the safe method of calling a function when you have its name as a string. Also, read about why you should not use eval().

How to Extend an Existing JavaScript Array with Another Array Without Creating a New Array

Read this JavaScript tutorial and learn about several useful methods for extending an existing an Array with another array without creating a new array.

How to Find out the Caller Function in JavaScript

Read this JavaScript tutorial and learn the accepted method of finding out the call stack. Get information about the obsolete method of getting the call.

How to Find the Min/Max Elements in an Array in JavaScript

Read this JavaScript tutorial and learn about the methods used to find the minimum and maximum number of elements in an array. Find the fastest solution.

How to Find the Sum of an Array of Numbers

Read this JavaScript tutorial and learn several methods used to find or calculate the sum of an array of numbers. Also, find which is the fastest one.