A question about Absolute Value in script call

I wrote this in the script box (the one on event page 3). I was hoping it would give me the absolute value of that variable.

DIX = DIX.absHowever, it results in 0 every time, it doesn't matter if "DIX" is positive or negative.

So my question is how do I make a variable assume its absolute value?

The end goal is to check the distance between 2 events.

EDIT:The two events are not always the same, so I don't want to use control variables to determine the distance. 

Wait wait, its more accurate to say that I'd prefer not to use control variables, looked over some old notes in ACE.

If the problem isn't with ".abs" I could solve this using the script box in control variables.
Well the .abs was a ruby function. For JS you will have to do:

Code:
Math.abs(your number or variable in here)
Worked amazingly, Thank you lots 🙂  

Original thread: https://forums.rpgmakerweb.com/threads/a-question-about-absolute-value-in-script-call.51174/