How to allocate current inlet and previous inlet to different var

    Jul 17 2013 | 2:19 pm
    Dear all.
    I am completely new to using javascript. But I am intending to find the rate of change or velocity of an inlet stream. So my idea is to find the difference between the current value and the previous value of the inlet. So the pseudocode I think is:
    a = inlet; wait for an interval x ms ; b = inlet; outlet = b - a;
    Can you help me out with this? What should the script be?
    Many thanks to you all.