flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harbs <harbs.li...@gmail.com>
Subject I just learned something in Javascript
Date Mon, 02 Jan 2017 11:08:50 GMT
Apparently Number(“1234”) is the same as a shorthand version: +”1234”. Both of these
will convert a string into a number and will give NaN if the string can not be converted to
a logical number.

Performance-wise, different browsers seem to give different results as to which one is faster.

I think we should make it standard practice to use “+” instead of Number() for casting
to Number in FlexJS. It will save 7 characters for every cast.

View raw message