Node.js slice() function Last Updated : 30 Mar, 2023 Comments Improve Suggest changes Like Article Like Report 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 string.start: This parameter holds the starting index of the sub-string.end: This parameter holds the ending index of the sub-string. Return type: The function returns the substring. The program below demonstrates the working of the function: Program 1: javascript function findsubstr(str) { const index = str.slice(12, 25); console.log(index); } const str = "Welcome to GeeksforGeeks"; findsubstr(str); Output: GeeksforGeeks Program 2: javascript function findsubstr(str, start, end) { const index = str.slice(start, end); console.log(index); } const str = "Welcome to GeeksforGeeks"; const start = 0; const end = 6; findsubstr(str, start, end); Output: Welcome Comment More infoAdvertise with us Next Article Node.js slice() function T Twinkl Bajaj Follow Improve Article Tags : Web Technologies Node.js NodeJS-function Similar Reads 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 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 p5.js splice() function The splice() function in p5.js is used to insert values or array elements in the given array.Syntax:Â Â splice(Array, Values, Position) Parameters: This function accepts three parameters as mentioned above and described below:Â Â Array: This is a given array which is to be modified.Values: This is the 3 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 Node.js substr() function 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 specifi 1 min read Like