Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
我会在那里使用 for 循环,即使它可以正常工作,但你没有调用该函数。在底部添加 fizzBuzz();
fizzBuzz();
i would have used a for loop there, even tho that would work fine, you didnt call the function. add fizzBuzz(); at the bottom
fizzBuzz();
var output = []; function fizzBuzz(){ for(var i=0; i<100; 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); } console.log(output); } } fizzBuzz();
for while 循环,
这样你就不需要计数变量,而且它更干净
for the while loop
that way you dont need a count variable and its much cleaner
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(2)
我会在那里使用 for 循环,即使它可以正常工作,但你没有调用该函数。在底部添加
fizzBuzz();
i would have used a for loop there, even tho that would work fine, you didnt call the function. add
fizzBuzz();
at the bottomfor while 循环,
这样你就不需要计数变量,而且它更干净
for the while loop
that way you dont need a count variable and its much cleaner