What is the best way to convert a number to string in javascript? I am familiar with these four possibilities:
Example 1:
let number = 2;
let string1 = String(number);
Example 2
let number = 2;
let string2 = number.toString();
Example 3
let number = 2;
let string3 = "" + number;
Example 4
let number = 2;
let string4 = number + "";
All examples giving the same result, but what is the best option to choose based on Performance? Or is it personal preference?
Thanks for answering.