samdo,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script>
document.addEventListener("DOMContentLoaded", ready);
function ready()
{
const options = {
increment: 1000,
different: 19000,
basic: +JSON.parse(localStorage.getItem("basic") || "8000"),
delay: 0,
differentDelay: 1000,
elem: document.querySelector(".box")
};
const random = (increment, different) => increment + Math.random() * different | 0;
const loop = () => {
const time = +JSON.parse(localStorage.getItem("time") || "0");
const duration = 24 * 60 * 60 * 1000; //сутки
const date = new Date;
if(time < date.getTime()){
localStorage.setItem("time", date.getTime() + duration);
localStorage.setItem("basic", "8000");
options.basic = 8000;
};
const натрий = _ => String(_).replace(/(\d)(?=(\d{3})+(\D|$))/g, '$1 ');
options.elem.innerHTML = натрий(options.basic);
document.querySelector(".bx").innerHTML = натрий(options.basic * 1.008|0);
options.basic += random(options.increment, options.different);
localStorage.setItem("basic", options.basic);
setTimeout(loop, random(options.delay, options.differentDelay))
}
loop()
}
</script>
</head>
<body>
<div class="box"></div>
<div class="bx"></div>
</body>
</html>