Skip to content

Instantly share code, notes, and snippets.

@AminBusiness
Created November 8, 2018 21:00
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 AminBusiness/21bdbf912aca6468196ab239bc2a9be1 to your computer and use it in GitHub Desktop.
Save AminBusiness/21bdbf912aca6468196ab239bc2a9be1 to your computer and use it in GitHub Desktop.
<script id="jsbin-javascript">
//How to add something to the beginning and end of an array
var myArray = ['a','b','c','d'];
myArray = ["start", ...myArray]
myArray = [...myArray, "end"]
myArray = ["start",...myArray, "end"]
console.log(myArray)
</script>
//How to add something to the beginning and end of an array
var myArray = ['a','b','c','d'];
myArray = ["start", ...myArray]
myArray = [...myArray, "end"]
myArray = ["start",...myArray, "end"]
console.log(myArray)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment