Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save matt-daniel-brown/1f5452b567a702d566fdd1aed30870f7 to your computer and use it in GitHub Desktop.
Save matt-daniel-brown/1f5452b567a702d566fdd1aed30870f7 to your computer and use it in GitHub Desktop.
Basic Javascript Stuff...
<!DOCTYPE html>
<title>My Example</title>
<p id="msg"></p>
<hr>
<p>The first parameter of <code>slice()</code> is a zero-based index to specify where the extraction begins. It extracts up to (but not including) the second parameter.</p>
<script>
var cities = ["Tokyo", "Auckland", "Sydney", "Brisbane", "Cairns", "London"];
citiesAU = cities.slice(2, 5);
document.getElementById("msg").innerHTML = cities + "<br>" + citiesAU;
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment