PDA

View Full Version : math


scroots
12-30-2002, 09:51 PM
i have the following code
lk=((xc*delay)+ep);
lk is one variable, xc is another delay is another and ep is another variable.
how can i properly calculate the value of lk?
in number terms

lk=((2*4)+2)
so lk is 10.

in the math tutorial on javascriptkit.com it doesn`t tell you
scroots

beetle
12-30-2002, 10:08 PM
Uh, did you even test that? It's right just as you have it! (although I personally use more spaces in my code)

var lk = ( ( xc * delay ) + ep );

However, the outer parentheses aren't necessary

var lk = ( xc * delay ) + ep;

scroots
12-30-2002, 10:13 PM
thank you, i didn`t think it was right thats all as it wasn`t a very long time delay when ep equalled about 400000

scroots

beetle
12-30-2002, 10:46 PM
a delay of 400000 should be 400 seconds, or 6 minutes and 40 seconds.

scroots
12-31-2002, 06:10 PM
well at least my math is correct i just need to rearrange my javascript as the math part wasn`t the problem


scroots