3 different methods for substring in javascript
Substring means a portion of a string. Substring is extracted based on numeric indexes. This article will explain 3 different ways in which a substring can be retrieved from a string in javascript. Method 1: substr function Javascript substr function takes two arguments with their meanings given below. 1. Start index: Index of character from which the substring will be extracted. 2. Count: Total number of characters or length of substring. Syntax of substr function is substr(index, length) By default characters in a string start at index 0 from left to right. Below illustration explains the working of substr function in javascript. Following points shouldRead More →