Practical solutions

JavaScript How-to Guides How-To Guides

Solve the problem. Keep building. A collection of practical JavaScript how-to guides

Find the answer you need

Browse practical solutions, grouped by the task you're working on.

__COUNT__ entries on this page

How to Convert XML to JSON in JavaScriptIn this article, learn how to convert XML strings to JSON format data with the help of regex and default string method matchAll() in JavaScript. How to Get the Selected or Highlighted Text in JavaScriptIn this article, we will see how to get the text that is selected by the user on the screen in JavaScript. How to Add Vector Class in JavaScriptThis article will teach you how to add vectors in JavaScript using a for loop, ES6 Map, ES6 class, and extending the native Array class. How to Validate Email With Regex in JavaScriptThis article will teach you multiple regular expressions that'll validate an email address in JavaScript. So you can select a pattern that suits your use case. How to Use __dopostback() in JavaScriptThe __dopostback() function is that extra feature that makes the web task more efficient. Technically, when a form or data is to be stored via a post method, it does not reload the webpage with a new instance. But, in real case scenario, the __dopostback() function ensures the post is done correctly. How to Sanitize String in JavaScriptThis JavaScript tutorial article explains what it means to sanitize data in JavaScript. Moreover, it discusses the different packages you can use to sanitize strings in JavaScript. How to Match Multiple Occurrences With Regex in JavaScriptThis tutorial discusses what a regular expression is and the different methods to match multiple occurrences in JavaScript. How to Marquee Element in JavaScriptIn this article we'll learn how to use marquee on webpage content using HTML tag and JavaScript custom function with different examples. How to Implement DOM Data Binding in JavaScriptThis JavaScript instructional post will tell you what is data binding and what are different methods to bind data in JavaScript. How to Get the Domain Name in JavaScriptIn this article, we are going to learn how to get domain name programmatically during the execution of a webpage using JavaScript events and functions. How to Fix Maximum Call Stack Size Exceeded Error in JavaScriptThere are numerous steps that you can take to fix a code that's eating up all of the available call stack within a browser. Through this JavaScript article, we'll go over in great detail what causes a Maximum Call Stack Size Exceeded error and how we can fix it. How to Destroy Object in JavaScriptDeletion of an object or its property can be performed by the delete operator and by creating a constructor that will hold a destroy method. The basic necessity for this drive is to keep track of elements and alter them according to need. JavaScript still does not have in-built ways of directly vanishing an object. How to Call External JavaScript Functions From Java CodeIn this article, we will learn how to include a JavaScript source in a Java program and call a JavaScript function from a Java code. How to Add JavaScript MDCRipple to Ajax Loaded ButtonThis article teaches you how to add MDCRipple to an HTML button loaded via AJAX. We'll set up a local server. Afterward, we'll import the MDC CSS and JavaScript files via UNPKG CDN. How to Overload Operator in JavaScriptThe operator overloading concept is generated to aid user-defined classes. With the help of this convention, we can easily calculate the unary and binary calculations. Unlike other object-oriented programming languages, JavaScript was introduced to the overloading syntax. How to Use Scientific Notation in JavaScriptIn today's post, we'll learn about scientific notation in JavaScript. How to Remove All Event Listeners in JavaScriptIn today's post, we'll learn about removing all the event listeners in JavaScript. How to Send POST Request Using XMLHttpRequest in JavaScriptIn this article, we are going to learn how to send an XMLHttpRequest post request in Ajax programming using JavaScript code with different examples. How to Generate Formatted and Easy-To-Read JSON in JavaScriptIn this article, we are going to learn how to use JSON formation like stringify JSON data and convert string data into JavaScript object using JavaScript language with different examples. How to Change String Character in JavaScriptIn this article, we are going to learn how to change specific character at specific index from given string values using multiple methods in JavaScript with different code examples. How to Build Strings in JavaScriptIn this article, we will learn how to generate or build a string using the concatenation operator and some built-in methods like join() in JavaScript with different code examples. How to Smooth Scroll in JavaScriptIn this article, we will learn how to use the smooth scroll feature in JavaScript. For the example, we will make events that will call the scrolling function. How to Make Ajax Call Without jQueryThis article teaches you how to make AJAX calls without using jQuery. We'll do this using XMLHttpRequest and the Fetch API. How to Hide Button in JavaScriptIn today's post, we'll learn about hiding buttons in JavaScript.