Skip to content

Instantly share code, notes, and snippets.

@K-Vishwak
Created January 30, 2022 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save K-Vishwak/36120f66e62597b5dcf958b9ccc7d7bb to your computer and use it in GitHub Desktop.
Save K-Vishwak/36120f66e62597b5dcf958b9ccc7d7bb to your computer and use it in GitHub Desktop.
const testString = "Hey, Welcome to urstrulyvishwaks articles";
// slice.
testString.slice(5,12); // start including end excluding.
> 'Welcome'
testString.slice(5); // only start value - Hence starting from 5 to end.
> 'Welcome to urstrulyvishwaks articles'
testString.slice(-25, -10); // accepts negative range.
> 'urstrulyvishwak'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment