Skip to content

Instantly share code, notes, and snippets.

@mikedao
Created March 23, 2016 16:24
Show Gist options
  • Save mikedao/df53e36944022a89b0f0 to your computer and use it in GitHub Desktop.
Save mikedao/df53e36944022a89b0f0 to your computer and use it in GitHub Desktop.

Exercises

  • If you had an array of numbers, e.g. [1,2,3,4], how do you print out the doubles of each number? Triples?
  • If you had the same array, how would you only print out the even numbers? What about the odd numbers?
  • How could you create a new array which contains each number multipled by 2?
  • Given an array of first and last names, e.g. ["Alice Smith", "Bob Evans", "Roy Rogers"], how would you print out the full names line by line?
  • How would you print out only the first name?
  • How would you print out only the last name?
  • How could you print out only the initials?
  • How can you print out the last name and how many characters are in it?
  • How can you create an integer which represents the total number of characters in all the names?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment