Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Substring in Javascript

const str = "Learning to code";

// 3 ways to get substring in javascript
// 1. substring() method
// 2. slice() method
// 3. substr() method

console.log(str.substring(0, 5));
console.log(str.substring(0, 5));
console.log(str.substr(2, 5));
Source by www.tutorialstonight.com #
 
PREVIOUS NEXT
Tagged: #Substring #Javascript
ADD COMMENT
Topic
Name
2+8 =