Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript How to print every number that is divisible by either 3 or 5, but not both

const threeOrFive = max => {
    const store = [];

    for(let i = 0; i < max; i++){
        if (i%3==0 && i%5==0) continue;
        else if (i%3==0) store.push(i);
        else if (i%5==0) store.push(i);
    }

    return store;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript remove last element 
Javascript :: react using button props child 
Javascript :: let a = {y;10}; 
Javascript :: js convert a string into a number 
Javascript :: parentnode javascript 
Javascript :: mariadb javascript 
Javascript :: best react native ui library 
Javascript :: push element in array javascript 
Javascript :: rad client datasource refetch 
Javascript :: factorial bigger than 170 javascript 
Javascript :: expo location background example 
Javascript :: mongodb js insertmany 
Javascript :: jquery check component exists 
Javascript :: jsconfig 
Javascript :: javascript get all elements of an id 
Javascript :: autocomplete data selected validation jquery 
Javascript :: datatables buttons do not appear localisation 
Javascript :: loop map with key value pair js 
Javascript :: javascript round down to 2 decimal places 
Javascript :: how to assign char in a string javascript 
Javascript :: node js middleware for parsing formdata 
Javascript :: jquery slick drag goes back 
Javascript :: symbol properties javascript 
Javascript :: order by type 
Javascript :: Ways to Declare Variables in Vanilla JavaScript 
Javascript :: js string to charcode array 
Javascript :: array prototype find javascript 
Javascript :: mouse over jest 
Javascript :: number vs bigint js 
Javascript :: gsheet formula get last item in column 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =