You Deserve Arrays

Introduction

This is an exercise for retrieving data from an array. Arrays are great and you will soon love them!

Challenges

  1. Write a program, getFirstItemFrom.js that prompts the user for an array, then logs out the first item in that array

  2. Write a program, getLastItemFrom.js that prompts the user for an array, then logs out the last item from that array

  3. Write a program getIndex3.js that prompts the user for an array then logs out the item at the 3rd index. If there are not four items (i.e., if there is no index 3), it logs out the value at the last index

  4. isLongList.js: prompts the user for an array then logs out a boolean indicating whether the array's length is at least 10

  5. firstItemIsNumber.js: prompts the user for an array then logs out a boolean indicating whether or not the first item in the array is a number

  6. secondCharOfThirdString.js: prompts the user for an array then logs the second character in the third item in the array. If the third item is not a string, log an error instead