View Full Version : what unit for time and distance

07-16-2003, 04:47 AM
I am trying to make a program where the user types in the distance travelled and the time and then it will calculate the velocity. I am wondering what unit distance and time in javascript. Is distance meters or miles? Is time seconds?

07-16-2003, 05:52 AM
Do you understand what you're asking?

The units you use are completely arbitrary - Javascript has no concept of units.

Velocity has units of distance/time. Whatever unit you use to measure distance and whatever unit you used to measure time go there. Javascript doesn't convert them into any other unit for you, nor does it even "know" how to unless to tell it.

07-16-2003, 09:45 AM
define your units as you like. You can use JavaScript as you use, say, multiplication table or logarithm table...:-) to operate some variables defined by yourself...

There are some cases in witch Java Script uses pre-define time units (miliseconds), but even in this case it use the computer's clock input, and only for setting and compare the time for some dynamic applications...