Nope, JS is all interpreted, eval just exposes a way to do it at runtime as well as load time. That's a smidge of a lie, but it's one that can be treated as truth in all but very exceptional cases.
cheers, barneyb On 7/17/07, Andy Matthews <[EMAIL PROTECTED]> wrote: > That's cool Barney. I didn't know it would be quite that efficient. Any > performance hits using eval? > > -----Original Message----- > From: Barney Boisvert [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 17, 2007 10:46 AM > To: CF-Talk > Subject: Re: Simple JS math? > > num + eval(frac) > > The latter operand will evaluate the string as if it were javascript (i.e. > do 3 / 8), which will give you the floating-point equivalent of the > fraction, which can then be added to the integer (giving 20.375). > > cheers, > barneyb > > On 7/17/07, Che Vilnonis <[EMAIL PROTECTED]> wrote: > > Looking to add an integer and a fraction. How do I do this with > Javascript? > > Thanks, Che! > > > > <script language="JavaScript"> > > var num = 20; > > var frac = "3/8"; > > var DBWTemp = (num + frac); > > document.write(DBWTemp); > > </script> > > > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ColdFusion MX7 and Flex 2 Build sales & marketing dashboard RIAâs for your business. Upgrade now http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283912 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

