dadhichvivek / twilio-javascript-folder Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://lab.github.com/Bahburs/learning-the-basics-of-javascript-(bit-project-+-twilio)
Home Page: https://lab.github.com/Bahburs/learning-the-basics-of-javascript-(bit-project-+-twilio)
For this assignment, you will follow the instructions and complete a task showing your knowledge of the subject at the end. If at any moment you need help, feel free to contact your TAs.
Create a file called fizzbuzz.js
FizzBuzz
FizzBuzz is a program used to demonstrate basic functionality of a language, often when switching between programing languages or as an introduction (that's us!) to first learning a language.
The goals of the program is to go through the numbers from 1 to 100 and print "fizz" whenever a number is divisible by 3, print "buzz" when it's divisible by 5, print "fizzbuzz" when it's divisible by both 3 and 5, and print the number when it's not divisible by either. For our program, you will do something very similar:
For the numbers from 1 to 100:
Tip: copy paste the emojis to get it into your code!
Use in line comments to explain how your code works. Commenting your code helps ensure that you understand what is happening, and helps the code reviewer read through your code easily. For example:
Great example:
var i; // Initialize a variable
for (i = 0; i < nums.length; i++) { // Initialize a for loop that iterates from 0 to length of the nums array
nums[i]+5; // At every iteration, add the i-th integer in the nums array to the text variable
} // End of loop
When you start writing more code (200+ lines) you will want to do the next example. For this course, your code should not extend past 50-100 lines and we want to use your comments to see how well you understand the concepts and language, so it's better to use the previous example.
Okay example:
// This code uses a for loop to iterate through the entire nums array and add 5 to each element
var i;
for (i = 0; i < nums.length; i++) {
nums[i]+5;
}
Don't do this:
// Add 5 to all values in nums array
var i;
for (i = 0; i < nums.length; i++) {
nums[i]+5;
}
In this program, you need to allow your program to take a second argument, so:
3. To run your fancy new program, type: node fizzbuzz.js
with an integer between 1-100 in terminal
To test your code, run it with different integers in the program argument to see what happens.
Test Case 1:
If you run node fizzbuzz.js 5
the output should be:
๐ฉ 1
๐ฉ 2
๐ฝ 3
๐ฉ 4
๐ 5
Test Case 2:
If you run node fizzbuzz.js 17
the output should be:
๐ฉ 1
๐ฉ 2
๐ฝ 3
๐ฉ 4
๐ 5
๐ฝ 6
๐ฉ 7
๐ฉ 8
๐ฝ 9
๐ 10
๐ฉ 11
๐ฝ 12
๐ฉ 13
๐ฉ 14
๐ฐ 15
๐ฉ 16
๐ฉ 17
Output example:
Task 1: Complete the FizzBuzz program as described above
Commit a file called fizzbuzz.js
Good job, you're fizzing and buzzing in space!
Welcome to Bit Project's Github Learning Lab on JavaScript.
This Learning Lab is going to teach you some of the fundamental coding skills you will need to start building awesome Javascript projects
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.