Logo

Programming-Idioms

History of Idiom 22 > diff from v27 to v28

Edit summary for version 28 by :
[JS] Comment line break

Version 27

2015-12-30, 21:24:31

Version 28

2015-12-30, 21:25:14

Idiom #22 Convert string to integer

Extract integer value i from its string representation s (in radix 10)

Idiom #22 Convert string to integer

Extract integer value i from its string representation s (in radix 10)

Code
i = 0+str;
Code
i = 0+str;
Comments bubble
JavaScript automatically converts a string to a number when you use it in a numeric expression. (This also works with floating point numbers.)
Comments bubble
JavaScript automatically converts a string to a number when you use it in a numeric expression.
(This also works with floating point numbers.)