Created
January 19, 2018 20:48
-
-
Save schamblee/531fae570f1883ba17e619283257c9e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Creating arrays | |
function makeList(item1, item2, item3) { | |
return [item1, item2, item3] | |
} | |
Adding array items | |
function addToList(list, item) { | |
list.push(item); | |
return list; | |
} | |
Accessing array items | |
function accessFirstItem(array) { | |
return array[0]; | |
} | |
function accessThirdItem(array) { | |
return array[2]; | |
} | |
Array length and access | |
function findLength(array) { | |
return array.length; | |
} | |
function accessLastItem(array) { | |
return array[array.length-1] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment