function fizzBuzz(){
for(let i=1;i<=100;i++){
if(i%3===0 && i%5===0){
console.log('fizzbuzz');
continue;
}
else if(i%3===0){
console.log('fizz')
continue;
}
else if(i%5===0){
console.log('buzz');
continue;
}
console.log(i);
}
}
fizzBuzz();
********************************
var output=[];
let i=1;
function fizzBuzz(){
if(i%3===0 && i%5===0){
output.push('fizzbuzz');
}
else if(i%3===0){
output.push('fizz');
}
else if(i%5===0){
output.push('buzz');
}
else{
output.push(i);
}
i+=1;
console.log(output);
}
fizzBuzz();
********************************
function fizzBuzz(){
var output=[];
for(let i=1;i<101;i++){
if(i%3===0 && i%5===0){
output.push('fizzbuzz');
}
else if(i%3===0){
output.push('fizz');
}
else if(i%5===0){
output.push('buzz');
}
else{
output.push(i);
}
}
return output;
}
-
Notifications
You must be signed in to change notification settings - Fork 0
Phuntsok68/fizzBuzz-
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published