Extracting a Portion of String with substring in Javascript


Use substring() to get a part of a string between two indices.

Source Code

let text = "Hello, world!";
console.log(text.substring(0, 5)); // "Hello"
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments