Skip to content

wdi-red-coral/hw-week_01-day_03-js-functions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

General Assembly Logo

JS Functions HW

Instructions

  1. Fork and clone this repository.
  2. Change into the new directory.
  3. Create and checkout a new branch, named response.
  4. When finished, git add, git commit, git push to your fork and submit a pull request.

Questions

  1. Rock, Paper, Scissors (watch the game)

    • Create a file in this repo named rps.js
    • Write a function that takes rock, paper, or scissors as an argument for the user choose, then chooses rock, paper, or scissors randomly for the computer choose, and returns whether the user win, lose, or `tie.
    • Example: playGame('rock') // Computer picked: paper. User picked: rock. User lose.
    • Hint: Javascript includes a Math.random method.
  2. Dice Roller

    • Create a file in this repo and name it dice.js
    • Write a function that chooses two random numbers (1-6) and returns them. It should also return the sum.
    • Example: rollDice() // Dice rolled are 6 and 1. Sum is 7
    • BONUS: have your function take an argument of the # of dice to be rolled.
    • Example: rollDice(3) // Dice rolled are 4, 2, and 7. Sum is 13.
  3. Research 3 string methods and describe what they are used for and how to use them. You can find string methods here https://www.w3schools.com/js/js_string_methods.asp

Method 1

Name:
Description:
Example using it:

Method 2

Name:
Description:
Example using it:

Method 3

Name:
Description:
Example using it:
  1. All content is licensed under a CC­BY­NC­SA 4.0 license.
  2. All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published