JSFiddle - React, Tailwind, and code Playground

by Alex Fogarty

JavaScript

function calculateInterest(investment) {
    var results;
    if (investment < 1000) {
        results = investment * 1.05;
    }
    if (investment < 50000) {
        results = investment * 1.08;
    }
    if (investment > 50000) {
        results = investment * 1.15;
    }
    alert(results);
}

// test our function
calculateInterest(500);
calculateInterest(20000);
calculateInterest(75000);