planets-array.js. Some practice with array methods.
Steps in js
- Created an array of planets
- Created a function for logging the planets array
- .unshift method. Added "The Sun" to the beginning of the planets array
- .push method. Added "Pluto" to the end of the planets array
- .shift method. Removed "The Sun" from the beginning of the planets array.
- .pop method. Removed "Pluto" from the end of the planets array.
- .indexOf method. Found and logged the index of "Venus" in the planets array.
- .splice method(remove). Created an index of pre-sliced element, then used the splice method to remove the planet after "Venus".
- .splice method(add). Used splice to add back the planet after "Venus".
- .reverse method. Reversed the order of the planets array.
- .sort method. sorted the planets array.