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.

Harbs

On Aug 5, 2016, at 5:48 PM, Harbs <harbs.li...@gmail.com> wrote:

> On second thought, this is probably wrong.
> 
> Number(xml) is probably enough as Number should call toString() and deal with 
> all number types correctly.
> 
> On Aug 5, 2016, at 5:42 PM, Harbs <harbs.li...@gmail.com> wrote:
> 
>> If it knows it’s being assigned to a Number, I think it should call 
>> valueOf(), or possibly(Number(xml.valueOf())
> 

Reply via email to