Code Monkey home page Code Monkey logo

hw-week_01-day_03-js-functions's Introduction

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].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.