How many ways to convert a value to string in JavaScript
1. value.toString()
1 | const num = 123; |
2. String(value)
1 | const num = 123; |
3. value + ‘’
1 | const num = 123; |
4. `${value}`
const num = 123;
const str = `${num}`;
5. JSON.stringify(value)
1 | const num = 123; |
What’s the difference between them?