As I saw this question
What's the best way to convert a number to a string in JavaScript?, It seems that if there is a var 'a' typeof number, a + ''
is the fastest way to convert to String.
And I don't know why, because in the last, a has to be called with toString
and binary operator shouldn't be checked with the type of both operands?
So Here's question
- Why is
a+''
the fastest way to convert a number to a string? - Is this the fastest way for all types or just numbers?