On 8/5/16, 8:05 AM, "Harbs" <harbs.li...@gmail.com> wrote:
>I just checked and Number(obj) is equivalent to Number(obj.valueOf()) > >Like so: >var a = {valueOf : function(){return "5"},toString:function(){return "6”}} > >Number(a) //5 >Number(a.valueOf()) //5 >Number(a.toString()) //6 > >So valueOf() needs to return a value that Number will properly accept. Makes sense. I'll see if I can get the compiler to generate better code. Regarding the use of parseInt in valueOf, would it make sense to see what Flash does and do the same thing? That way the compiler can hopefully just understand the differences between AS and JS type conversions and generate the proper code. -Alex