Category: JavaScript

Substrings in JavaScript

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

String Replace Function with RegEx in JavaScript

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

String Functions in JavaScript

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

Escape Sequence Character in JavaScript

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

isNaN() Function in JavaScript

NaN stands for not a number in JavaScript.  Floats and integers are basically numbers.  IsNaN() function checks whether the value is number or not.  It will return true or false. This function will be helpful in case you want to avoid users from passing any value other than a number.   Example is given below where