Skip to content

Instantly share code, notes, and snippets.

@seandaniel
Last active July 31, 2020 14:07
Show Gist options
  • Save seandaniel/17dbd91d593032ebafd1895e18f82565 to your computer and use it in GitHub Desktop.
Save seandaniel/17dbd91d593032ebafd1895e18f82565 to your computer and use it in GitHub Desktop.
How to use the slice() method
const randomTorontoInfo = ['CN Tower', 'Partly Cloudy', '20°C', 'Blue Jays', 'Doug Ford', 'The Six'];
const weatherToronto = randomTorontoInfo.slice(1, 3);
console.log(weatherToronto)
// ['Partly Cloudy', '20°C']
console.log(randomTorontoInfo);
// ['CN Tower', 'Partly Cloudy', '20°C', 'Blue Jays', 'Doug Ford', 'The Six'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment