- Open your command line and navigate to your
reposdirectory (if you do not have areposfolder, then you can usemkdir reposto create one) - Use this template repository to start a new project in your repos folder:
git clone <repo_name> - cd
repo_nameto navigate into your new repo directory - Start Visual Studio Code and select 'Open Folder'. Then select
repo_nameto open the folder in the editor (or just typecode .in your terminal inside the repo directory) - Follow the instructions on the README.md file to complete exercises
- Open the app.js file to get started
In this exercise, you will be counting from 1 - 100. For each odd number, you will print the number to the console. If the number is even, do nothing.
- Create a
for loopthat evaluates numbers from 1 to 100. - Inside the loop body, write an
if/elseselection statement that checks whether a number is odd - If the number is odd, then print the number to the console, otherwise do nothing and continue to the next number
1
3
5
...
FIZZBUZZ is a very common coding interview problem. Below are the instructions to solving the problem:
- Create a
for loopthat evaluates numbers from 1 to 100 like the problem above. - Write a
if/elseselection statement inside the body of the the loop that checks the following:- If the number is divisible by 3, then
console.log'FIZZ' - If the number is divisible by 5, then
console.log'BUZZ' - If the number is divisible by both 3 and 5, then
console.log'FIZZBUZZ'
- If the number is divisible by 3, then
Ex: 15 would print 'FIZZBUZZ', 33 would print 'FIZZ', and 35 would print 'BUZZ'