Toon Van de Putte schrieb:
I was wondering if the following two lines of code are just different ways
of doing the same thing:

var myVar = new Number();
myVar ="0";

var myVar= Number("0");
Except the fact you'd never pass a string ("0") where a number is expected (0), the only difference between the two is the number of characters needed to reach the goal. Furthermore, when you also declare the type of your variable, you'll get some type checking during compile time, which is less error-prone:

var myVar:Number = new Number(0);

or else

var myVar:Number = new Number();
myVar = "0"; <-- issues an error during compile time, since "0" (string) is not of type Number!


Best regards,
Roman.

--

-------------------------------------------------------------------
gosub communications gmbh | fredersdorfer str. 10  | 10243 berlin
t [030] 29 66 88 81 | f [030] 29 66 88 84 | http://www.gosub.de
-------------------------------------------------------------------

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to