Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Using Math Functions in an IF statement

for (i=1; i<21; i++) {

    if(i%3 === 0 && i%5 !== 0) {
        console.log("Fizz");
    } 

    else if (i%5 === 0 && i%3 !== 0) {
        console.log("Buzz");
    }

    else if (i%5 === 0 && !i%3 === 0) {
        console.log("FizzBuzz");
    }
    else {
       console.log(i); 
    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: && in react jsx 
Javascript :: how to redirect from login page to other page if user is already logged in in angular using jwt 
Javascript :: how to see the defenition of a function inside browser console 
Javascript :: underscore filter array of objects 
Javascript :: check the constructor property to find out if an object is a Date (contains the word "Date"): 
Javascript :: %20find%20all%20docs%20that%20have%20at%20least%20two%20name%20array%20elements_ 
Javascript :: deez 
Javascript :: jquery set focus on first input which is not readonly 
Javascript :: localstorage API JS get Item 
Javascript :: "Lua" 
Javascript :: javascript check if string contains capital letter 
Javascript :: next field 
Javascript :: preview.cookie-consent.js 
Javascript :: locale data angular 12 
Javascript :: This will give Iodoform reaction on the treatment with Na2CO3 and I2: 
Javascript :: ES6 template literals sum example 
Javascript :: change iphone return in keyboard to search in react native 
Javascript :: parsing data to node application 
Javascript :: map for id 
Javascript :: cors error in post request resolved 
Javascript :: javascript onclick event add html element 
Javascript :: check if a package is compatible with node 14 
Javascript :: dynamodb json to normal json 
Javascript :: react native biometrics sign in 
Javascript :: xpath last node 
Javascript :: misturar dois arrays javascript 
Javascript :: google sheets simulate edit event 
Javascript :: angular ng build setting body min-width 
Javascript :: React Rendering Movies 
Javascript :: convert nested json to query string 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =