An open API service indexing awesome lists of open source software.

https://github.com/jswesterfield/planets-js

planets-array.js. Some practice with array methods.
https://github.com/jswesterfield/planets-js

Last synced: 6 months ago
JSON representation

planets-array.js. Some practice with array methods.

Awesome Lists containing this project

README

          

# planets-js
planets-array.js. Some practice with array methods.

![alt text](http://25.media.tumblr.com/f84cef4ac540f26e94ae11955425d9a9/tumblr_n2v0ziFCtk1sw0e4co1_500.jpg "Logo Title Text 1")

**Steps in js**

1. Created an array of planets
2. Created a function for logging the planets array
3. _.unshift method_. Added "The Sun" to the beginning of the planets array
4. _.push method_. Added "Pluto" to the end of the planets array
5. _.shift method_. Removed "The Sun" from the beginning of the planets array.
6. _.pop method_. Removed "Pluto" from the end of the planets array.
7. _.indexOf method_. Found and logged the index of "Venus" in the planets array.
8. _.splice method(remove)_. Created an index of pre-sliced element, then used the splice method to remove the planet after "Venus".
9. _.splice method(add)_. Used splice to add back the planet after "Venus".
10. _.reverse method_. Reversed the order of the planets array.
11. _.sort method_. sorted the planets array.