The fastest way to convert a string to a number is using the + operator
eg. let num = +"5"
For further actions, you may consider blocking this person and/or reporting abuse
The fastest way to convert a string to a number is using the + operator
eg. let num = +"5"
For further actions, you may consider blocking this person and/or reporting abuse
Shahar Kazaz -
Md. Fahim Bin Amin -
Pelle Nilsen -
nnamdi nwaocha -
Top comments (2)
This is literally the opposite of what's true:
perf comparison
Overall in real world applications, the performance difference is probably negligible unless you have to convert millions of numbers.
Less code does not equal "faster" or "better".
according to MDN