JSFiddle - React, Tailwind, and code Playground
JavaScript
probe_worth = itemProbe.gain / itemProbe.currentCost;
spudnik_worth = itemSpudnik.gain / itemSpudnik.currentCost;
plant_worth = itemPotatoPlant.gain / itemPotatoPlant.currentCost;
tower_worth = itemTaterTower.gain / itemTaterTower.currentCost;
if (probe_worth > spudnik_worth) {
console.log("buy_probe()");
}
if(spudnik_worth > plant_worth) {
console.log("buy_spudnik()");
}
if (plant_worth > tower_worth) {
console.log("buy_plant()");
} else {
console.log("buy_tower()");
}