This is to keep track of my activities as i participate in the 100 days of code by ALX_Africa.
Today marks the beginning of my #100DaysOfCode challenge, and I decided to kick it off by revisiting one of the fundamental data structures in JavaScript: Array
as a data structure is like a big container into which we can throw variables inside and reference later. Arrays can hold any number of values we want and they are also zero-based, meaning the first element is at index 0, the second at index 1, and so on.
- Push(): This method adds elements to the end of the array
- Pop(): Removes the last element of the array and we don't have to pass any argument
- Unshift(): Adds element to the beginning of the array
- Shift(): Removes element from the beginning.
- Slice(): Used to extract parts of an array without changing the original array
- Splice(): Works like the slice method but changes the original array. The extracted elements are taken out of the array
- indexOf(): Tells us in which position a certain element is in the array. Returns -1 for element not in the array.
- include(): returns true if the element is in the array.
- forEach(): Used for looping through an array