cyberhorsey / basic-exercises

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

  1. Declare a function that takes 4 arguments, and adds them all together, and returns the sum.

  2. Declare a function that takes two arguments, and if the first argument is greater than the second one, return true, otherwise return false.

  3. Declare a function that takes a single argument, an array of numbers, and loops over all the elements of the array, adding them together, and returning the total sum of all the elements in the array.

  4. Declare an object that two properties, "numberOne", and "numberTwo", and a function on that object called "addAllNumbers", that returns the difference of numberOne minus numberTwo.

  5. Declare an array that takes in a single argument, a string, and returns the string lower-cased. ie: I pass in "Crane Juice", it should return "crane juice".

  6. Declare a function that checks if an element is in an array. It takes two arguments, the array, and the element to look for. If the element is found, return true, otherwise, return false.

  7. Declare an object that has a single property, "clothes", which is an empty array, a function on that object called "putOnClothes" which take a single argument, an item of clothes you want to put on (which will be a string, like "hat"). If the object is already wearing that piece of clothing, throw an error, otherwise, add the clothes to the array and log out the new clothes array.

  8. Declare a function that takes in a single argument, a name, and then says hi to that name via the console, UNLESS that name is one of the leaver's names: tums, piccle, or interesting, in which case it instead tells that user to fuck off via the console.

  9. ROCK PAPER SCISSORS! Declare a function that plays rock paper scissors with you via the prompt-promise npm package. The funcion should prompt you for your decision, then cheat, and always pick the winning move, so you can never win.

  10. Do your rock paper scissors function again, but it selects randomly, not cheating.

  11. Modify your rock paper scissors function to keep track of the score, and log it out after every round. So more than 1 round can be played at a time, in a loop. AFter every round it should say "Your Score: {yourScore}, ComputerScore: {computerScore}.

  12. Modify your rock paper scissors function so that after one player gets to 5 points, the game ends.

About