JSFiddle - React, Tailwind, and code Playground

by Jessie Lau

HTML

Add all the values between 100 and 4000000 inclusively that are divisable by 3 or 5 but not both 3 and 5

JavaScript

function addAllValue() {
    var sum = 0;
    for (var i = 100; i <= 4000000; i++) {
        if (i % 3 === 0 && i % 5 === 0) {
            continue;
        }
        if (i % 3 === 0 || i % 5 === 0) {
            sum += i;
        }

    }
    return sum;
}
console.log(addAllValue());