I’m trying to create an equation for a time calculation but can’t figure out what I need to do. I have a time in minutes that is getting multiplied by .005 which that number is then subtracted by the time to create a new time number. I then need this to repeat x amount of times. Here is the excel version of it but I don’t know how to write it in code to make it work once you input the time number.
What I currently have is this:
var time = document.getElementById("buildTime").value;
var x = time * .005;
const timeReduction = () => {
time * .005 = -x + time;
}
2
Answers
This simply doesn’t make sense:
Even if that line of code worked, what would the expected result be? Should
time
be modified by this or not?Perhaps you meant this?:
For example:
Which can even be simplified a bit:
Because subtracting
x * .005
fromx
is the same result as simplyx * .995
.I’m going to add an additional option here that doesn’t require a loop.
If want to do this ‘n’ times, you can do: