so i got an exercises in javascript and now some PHP but it was long ago and i start to come back to code. i taking a course on web development and i need to PRINT ALL NUMBERS DIVISIBLE BY 5 AND 3 BETWEEN 5 AND 50. so its not working out so much and the com ignoring my if and else statement. i want to understand why its happening. tnx for everyone
console.log("PRINT ALL NUMBERS DIVISIBLE BY 5 AND 3 BETWEEN 5 AND 50");
var num = 0 ;
if(num = 0){
num++;
console.log(num + " first if");
}
else if (!(num % 3 === 0 && num % 5 === 0)){
num ++;
console.log(num + " second if");
}
else {
while(num <= 50){
console.log(num);
num++;
}
}
Aucun commentaire:
Enregistrer un commentaire