Advertisement
Crevice

Array Challenge 1

Nov 12th, 2019
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. /*** ARRAY EXERCISES ***/
  2.  
  3. //create a variable that contains an empty array called myCohort
  4.  
  5. //add your name to the array
  6.  
  7. //add the name of two of your cohort mates to the end of the array
  8. //this should only require calling one method, and should be done on one line
  9.  
  10. //add another cohort mate's name to the beginning of your array
  11.  
  12. //log out your array and look at its contents. is it what you expected?
  13.  
  14. //remove the item at the end of your array, and add it to the beginning of your array
  15.  
  16. //log out your array using console.table, and observe its values
  17.  
  18. //find the middle index of your array, and add three new names at that index
  19.  
  20. //log out your array again and check its value
  21.  
  22. //at the beginning of your array, add a nested array with the names of three instructors in it
  23. //console log out the value at index 2 in the nested array
  24.  
  25.  
  26. /****** EXTRA HARD CHALLENGE MODE ******/
  27.  
  28. //create a function that makes and returns back an object that acts like an array.
  29. //it should have incremented key names, a length property, and a push method
  30. //EXTRA EXTRA CHALLENGE:
  31. //give it an unshift method, and make the values at each index move forward to account for the new entry at the "0" index
  32.  
  33. /****** END EXTRA HARD CHALLENGE MODE ******/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement