|
|
|
|
|
by gildas
4055 days ago
|
|
> You can also use the unary + operator to convert values to numbers: + "42"; // 42
> [...] However the "+" operator simply converts the string to NaN if there is any invalid character in it.Being a bit pedantic here, why not recommending the Number function which may be less obscure for beginners? Number("42"); // 42
|
|