1
I want to exponentially increase the speed of changing the value of a variable. I tried to do this, but it didn’t work. When trying to do this, I used 2 setInterval, but it didn’t work. In the code below I tried to increase the speed in the change of the value of variable x, but it didn’t work very well. I would like you to help me and I would also like to know how I do to exponentially increase the value change speed of variable x.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<p id="vel"></p>
<script>
var x = 100;
var y = 1000;
document.getElementById("vel").innerHTML = x;
var exponencial = setInterval(function() {
y -= 2*pow(2, 4);
}, 1000);
var time = setInterval(function() {
x += 1;
document.getElementById("vel").innerHTML = x;
}, y);
</script>
</body>
</html>
It is worth remembering that the method
pow
that he’s calling is wrong, the correct isMath.pow()
.– NoobSaibot