Re: passing arguments



RobG said the following on 8/13/2006 11:55 PM:
dtshedd@xxxxxxxxx wrote:
I am having trouble with arguments in a javascript routine. What I am
trying to do is to limit the size of numbers to ten digits but make use
of the significant places if the number is less than one.


There are lots of issues to cover here, have a look at Dr J's site at
the link below, it nicely covers rounding and precision in one spot,
though you may need other advice too:

<URL: http://www.merlyn.demon.co.uk/js-rndg1.htm#RoundSF >

You may want to choose another name to call JRS, as "Dr. J" was a professional basketball player in the USA as was John Stockton. The latter, it is my understanding, is the reason he posts as Dr. John instead of just John.

<snip>

digits=Precision(number)

Use semi-colons to end statements

I have had that discussion, in depth, with Richard and others in the past. Unless a person knows, beyond doubt, where to insert semicolons, you are better off leaving them out as the UA will always know where it wants them and where it doesn't. When asked to provide "typical" code where the lack of a semicolon caused an error when the semicolon removed it, I got one example and Richard couldn't remember the full context. But, there are places that adding a semi-colon to the end of a line will cause errors where the lack of that semi-colon isn't an error.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
.



Relevant Pages