I've been doing some tiny JavaScript stuff for web pages, and I've run across a problem. I want to convert some large numbers into exponential notation.
It seems the method is varname.toExponential(a), where a inside is the number of decimal places to which you want the number rounded.
The problem is, this method seems to not work with Safari, so I was wondering what the best way is to check if a browser supports this method, and if it doesn't, then just display the big long number. I don't want to simply browser sniff for Safari, because other browsers (like Mac IE) don't support it either -- so it would be nice just to check if the browser supports the function, and then use it if it does.
Any suggestions?
It seems the method is varname.toExponential(a), where a inside is the number of decimal places to which you want the number rounded.
The problem is, this method seems to not work with Safari, so I was wondering what the best way is to check if a browser supports this method, and if it doesn't, then just display the big long number. I don't want to simply browser sniff for Safari, because other browsers (like Mac IE) don't support it either -- so it would be nice just to check if the browser supports the function, and then use it if it does.
Any suggestions?