JavaScript Strings Substrings with slice

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Use .slice() to extract substrings given two indices:

var s = "0123456789abcdefg";
s.slice(0, 5);  // "01234"
s.slice(5, 6);  // "5"

Given one index, it will take from that index to the end of the string:

s.slice(10);    // "abcdefg"


Got any JavaScript Question?