JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<center>
<h1>Prices</h1>
<span id="prices"></span>
</center>
</body>
JavaScript
var money;
var Display = document.getElementById("prices")
//0 = name, 1 = Low, 2 = High
var drugs = [
["Acid", 1000, 4500],
["Cocaine", 1500, 3000],
["Hanish", 450, 1500],
["Heroin", 5000, 1400],
["Ecstasy", 10, 60],
["Smack", 1500, 4500],
["Opium", 500, 1300],
["Crack", 1000, 3500],
["Peyote", 100, 700],
["Shrooms", 600, 1400],
["Speed", 70, 250],
["Weed", 300, 900]
]
//In order of drugs
var st = [0, 0, 0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0]
function sleep() {
st[0] = Math.floor((Math.random() * drugs[0][1]) + drugs[0][2]);
st[1] = Math.floor((Math.random() * drugs[1][1]) + drugs[1][2]);
st[2] = Math.floor((Math.random() * drugs[2][1]) + drugs[2][2]);
st[3] = Math.floor((Math.random() * drugs[3][1]) + drugs[3][2]);
st[4] = Math.floor((Math.random() * drugs[4][1]) + drugs[4][2]);
st[5] = Math.floor((Math.random() * drugs[5][1]) + drugs[5][2]);
st[6] = Math.floor((Math.random() * drugs[6][1]) + drugs[6][2]);
st[7] = Math.floor((Math.random() * drugs[7][1]) + drugs[7][2]);
st[8] = Math.floor((Math.random() * drugs[8][1]) + drugs[8][2]);
st[9] = Math.floor((Math.random() * drugs[9][1]) + drugs[9][2]);
st[10] = Math.floor((Math.random() * drugs[10][1]) + drugs[10][2]);
st[11] = Math.floor((Math.random() * drugs[11][1]) + drugs[11][2]);
Display.innerHTML =
"<button onclick='buy(0)'>Buy</button>Acid: $" + st[0] +
"<button onclick='sell(0)'>Sell</button><br><button onclick='buy(1)'>Buy</button>Cocaine: $" + st[1] +
"<button onclick='sell(1)'>Sell</button><br><button onclick='buy(2)'>Buy</button>Hanish: $" + st[2] +
"<button onclick='sell(2)'>Sell</button><br><button onclick='buy(3)'>Buy</button>Heroin: $" + st[3] +
"<button onclick='sell(3)'>Sell</button><br><button onclick='buy(4)'>Buy</button>Ecstacy: $" + st[4] +
"<button onclick='sell(4)'>Sell</button><br><button onclick='buy(5)'>Buy</button>Smack: $" + st[5] +
"<button onclick='sell(5)'>Sell</button><br><button onclick='buy(6)'>Buy</button>Opium: $" + st[6] +
"<button...