In web development, it is important to detect certain events such as a browser close event in order to handle any unfinished tasks or to clean up any resources that might still be in use. In this tutorial, we will learn how to detect the browser close event in JavaScript. To detect the browser close
Substring is basically a part of string which you want to extract from a given string. There are 3 of methods in JavaScript which can do the job for you. substring(): This method takes 2 parameters. The first parameter is start and second parameter is end. Both the parameters take a numerical value which represents
As you know, replace() function is used to replace value in a given string. It also takes regex as parameter to perform the search for replacement. With regex, you can perform 2 kinds of searches, global case-sensitive and global case-insensitive. For global case-sensitive search, we add g at the end of regex and for global
We have couple of functions to manipulate strings in JavaScript. Mostly commonly used functions are given below with example. toUpperCase(): This function will change the case of a string to upper. toLowerCase(): This function will change the case of a string to lower. trim(): This function will remove any extra white space at the start
In JavaScript, we have some characters which have some special meaning. For example, a string is always surrounded by double quotation marks or single quotation marks. First quotation mark determines the start of a string and second quotation mark determines the end of a string. But in case, you want to write a string on