Node.js substr() function Last Updated : 30 Mar, 2023 Comments Improve Suggest changes Like Article Like Report The substr() function is a string function of Node.js which is used to extract sub-string from the given string. Syntax: string.substr(index, length) Parameters: This function accepts two parameters as mentioned above and described below: index: This parameter holds the starting index of the specified sub-string.length: This parameter holds the length of the sub-string. Return Value: The function returns the sub-string from the given string. The below programs demonstrate the working of substr() function: Example 1: javascript function findsubstr(str) { let substring = str.substr(11, 13); console.log(substring); } const str = "Welcome to GeeksforGeeks"; findsubstr(str); Output: GeeksforGeeks Example 2: javascript function findsubstr(str, index, length) { let substring = str.substr(index, length); console.log(substring); } const str = "Welcome to GeeksforGeeks"; const index = 11, length = 13; findsubstr(str, index, length); Output: GeeksforGeeks Comment More infoAdvertise with us Next Article Node.js substr() function T Twinkl Bajaj Follow Improve Article Tags : Web Technologies Node.js NodeJS-function Similar Reads Node.js trim() function The trim() function is a string function of Node.js which is used to remove white spaces from the string. Syntax: string.trim() Parameter: This function does not accept any parameter. Return Value: The function returns the string without white spaces. The below programs demonstrate the working of tr 1 min read Node.js split() Function Splitting a string is one of the most widely used functions by the split() method, which splits a string into an array of substrings. This function belongs to the prototype in JavaScript and is applied in many kinds of activities like data parsing from files, extracting information from URLs, or tex 2 min read Node.js MySQL SUBSTRING() Function SUBSTRING() function is a built-in function in MySQL that is used to get a substring of input string between given range inclusive. Syntax: SUBSTRING(input_string, from, length)Parameters: It takes three parameters as follows: input_string: It is the given string for which the substring will be exec 2 min read Node.js slice() function The slice() function is a string function of Node.js which is used to extract sub-string from a string. Syntax: string.slice( start, end ) Parameters: This function uses three parameters as mentioned above and described below: string: It holds the string content. The substring is extracted from this 1 min read Node.js pop() function pop() is an array function from Node.js that is used to remove elements from the end of an array. Syntax: array_name.pop() Parameter: This function does not take any parameter. Return type: The function returns the array. The program below demonstrates the working of the function: Example 1: javascr 1 min read Like