+ 1
For loop error in javascript?
I mostly code in c++, I know the basics of JavaScript, barely. and I'm confused as to why this code isn't working? a simple For loop isn't working so I have no idea what I'm doing. https://code.sololearn.com/cxvlkz0jA1J6/?ref=app
4 Réponses
+ 3
it's JavaScript not Java, he's just put the code into a Java project by accident
+ 2
var FizzBuzz="";
for(var i=0;i<100;i++){
var FizzBuzz="";
if(i%3!=0 && i%5!=0){
FizzBuzz+=i;
}
if(i%3==0){
FizzBuzz+="Fizz";
}
if(i%5==0){
FizzBuzz+="Buzz";
}
document.write(FizzBuzz);
create web code and add that to js tab and it should run ;)
+ 1
This is not a JavaScript code,It's java and I'm not good with Java,
+ 1
first of all you are trying to incorporate JavaScript into Java so that is where all the errors are coming from