How-to articles, tricks, and solutions about JAVASCRIPT

How to Retrieve an HTML Element's Actual Width and Height

Read this tutorial and learn about the two methods that are used to retrieve an HTML element’s actual width and height. Find the best method for your case.

How Does the Access-Control-Allow-Origin Header Work

Read this tutorial and learn about how the Access-Control-Allow-Origin response header works. Also, read about CORS, the origin, and non-simple requests.

What is the Difference Between Substr and Substring

Read this JavaScript tutorial and learn about the two String manipulation functions, namely, substr() and substring() methods and difference between them.

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 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 Print a Message to the Error Console Using JavaScript

Read this tutorial and learn about the role of console object in JavaScript and, also, learn the way of printing the message to the error console easily.

What is the Difference Between JSON.stringify and JSON.parse

Read this JavaScript tutorial and learn about two useful JSON methods that are used for converting JavaScript object into string and vice versa easily.

How to Get All Property Values of a JavaScript Object

Read this tutorial and learn about several methods used for detecting the property values of an object without knowing the key based on specifications.

How to Convert Set to Array in JavaScript

Read the tutorial and learn about several methods used for converting Set to Array in JavaScript. Also, read about differences between these two structures.

How to Loop Through Array and Remove Items Without Breaking the For Loop

Read this JavaScript tutorial and learn some useful information about the method of looping through an Array and removing items without breaking for loop.

How to Calculate Text Width with JavaScript

Read this JavaScript tutorial and learn about the best method of calculating the text width. Read about the advantages of the method over other methods.

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 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 Get the Value of a Textarea using jQuery

Read this tutorial and learn useful information about how you can detect the value of the HTML <textarea> element easily using one of the jQuery methods.

How to Uncheck a Radio Button

Read this tutorial and learn useful information about the two jQuery and JavaScript solutions to unchecking a radio button, and choose the method you want.

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 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 Get JavaScript Stack Trace When Throwing an Exception

Read this JavaScript tutorial and learn useful information about the two methods that are used in programming to get stack trace when throwing an exception.

How to Convert Arguments Object to an Array

Read this JavaScript tutorial and learn information about the useful methods that are used for converting array-like arguments object to an Array easily.

How to Get the Index of an Array that Contains Objects in JavaScript

Read this JavaScript tutorial and learn several useful, fast and simple methods that are used for getting the index of an array that contains objects.

How to Clone a Date Object in JavaScript

Read the tutorial and learn two useful methods that are used to clone the Date object in JavaScript. Get the current date and the cloned one right away.

How to Get File Extensions with JavaScript

Read this tutorial and learn several useful, fast and simple one-line and extended solutions of extracting file extensions with the help of 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 Select All Text in HTML Text Input When Clicked Using JavaScript

Read the tutorial and learn the two methods of selecting the entire text in HTML text input when clicked using JavaScript code snippets. Also, see examples.

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.

1 2 3 4 5