Programming-Idioms

History of Idiom 22 > diff from v3 to v4

Edit summary for version 4 :

Version 3

2015-07-31, 19:00:48

Version 4

2015-08-01, 16:38:37

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;
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.)