Category: javascript
Extracting characters from a string, between two specified indices using JavaScript : substring()
The substring() method in JavaScript extracts characters from a string, between two specified indices, and returns the new sub string….
Extracting a section of a string and returns it as a new string in JavaScript : slice()
This article provides an in-depth look at the slice() method, complete with executable examples, ensuring you can understand and use…
Dividing a string object into an ordered list of substrings and returns them in an array in JavaScript: split()
The split() method divides a String object into an ordered list of substrings and returns them in an array. The…
How to returns an integer between 0 and 65535 representing the UTF-16 code unit at the given index in JavaScript : charCodeAt()
The charCodeAt() method in JavaScript returns an integer between 0 and 65535 representing the UTF-16 code unit at the given…
How to extract single character located at a specified offset in the string using JavaScript : charAt()
The charAt() method in JavaScript returns a new string consisting of the single character located at a specified offset in…
How to pad the end of a string with another string until the desired length is achieved : padEnd()
The padEnd() method in JavaScript is used to pad the end of a string with another string until the desired…
How to pads the current string with another string in JavaScript : Add 0’s to the left of a character : padStart()
The padStart() method pads the current string with another string (multiple times, if needed) until the resulting string reaches the…
Removing whitespace from the beginning of a string using JavaScript : trimStart()
JavaScript’s trimStart() method, also known as trimLeft(), is used to remove whitespace from the beginning of a string. Similar to…
Removing whitespace from both ends of a string using JavaScript : trim()
JavaScript’s trim() method is used to remove whitespace from both ends of a string. Whitespace in this context includes all…
Merging two or more strings using JavaScript: concat()
The concat() method is used in JavaScript to merge two or more strings, returning a new string that is the…