Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello World #1

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 27 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
# FizzBuzz

1. Fork this repo
* Go to this repo's GitHub page (https://github.com/techswitch-learners/Fizzbuzz-js)
* Click `Fork` in the top-right of the page - this will create a copy of this repo in **your own GitHub account**
Run this command to run your code:
`node fizzbuzz.js`

2. Clone (download) the repo
* Go to your newly-created fork of the repo (on GitHub).
* Click `Clone or download` (the green button on the right).
* Make sure the page says `Clone with HTTPS` (rather than `Clone with SSH`).
* Open your git client (e.g. Git bash or GitKraken) and use this link to clone the repo.
Your trainer will able to help you with this.
Goals:
- Basic JS Syntax
- Basics of git
- Debugging in VSCode > breakpoints, Watch
- Writing clean code

3. "Cloning the repo" will create a folder on your computer with the files from this repo.
Open this folder in Visual Studio Code.
### Set up
Install node.js
Install Git Bash
Add `.gitignore` file

4. Open a command-prompt in this same folder.
Your trainer can show you how to do this, if you need any help.
Useful git commands:
`git status`
`git add .`
`git commit -m "Informative commit message goes here"`
`git push`

5. Run this command to run your code:
`node fizzbuzz.js`
### Incremental updates
1. Print every number from 1 to 100.
2. Print “Fizz“ whenever the number is a multiple of 3 instead of the number itself.
3. Print “Buzz” whenever the number is a multiple of 5. Print “FizzBuzz” whenever the number is a multiple of 3 and 5.
4. If a number is a multiple of 7, print "Bang" instead of the number. For numbers which are multiples of seven and three / five, append Bang to what you'd have printed anyway. (E.g. 3 * 7 = 21: "FizzBang").
5. If a number is a multiple of 11, print "Bong" instead of the number. Do not print anything else in these cases. (E.g. 3 * 11 = 33: "Bong")
6. If a number is a multiple of 13, print "Fezz" instead of the number. For multiples of most other numbers, the Fezz goes immediately in front of the first thing beginning with B, or at the end if there are none. (E.g. 5 * 13 = 65: "FezzBuzz", 3 * 5 * 13 = 195: "FizzFezzBuzz"). Note that Fezz should be printed even if Bong is also present (E.g. 11 * 13 = 143: "FezzBong")
7. If a number is a multiple of 17, reverse the order in which any fizzes, buzzes, bangs etc. are printed. (E.g. 3 * 5 * 17 = 255: "BuzzFizz")
8. Prompt the user for a maximum number
9. Allow the user to specify command-line-options (Let the user pass in which rules to implement)
10. Can you write the Fizz, Buzz, Bang version in a single line?
15 changes: 13 additions & 2 deletions fizzbuzz.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,19 @@ function fizzbuzz() {

console.log('Welcome to FizzBuzz!');

// Put your code here...

for (let i=1; i <= 100; i++) {
if (i % 3 === 0 && i % 5 === 0) {
console.log("FizzBuzz");
}
else if (i % 3 === 0) {
console.log("Fizz");
} else if (i % 5 === 0) {
console.log("Buzz");
}
else {
console.log(i);
}
}

}

Expand Down