Test name | Executions per second |
---|---|
String() | 1649765.5 Ops/sec |
.toString() | 1800365.4 Ops/sec |
add empty string | 1705237.9 Ops/sec |
let num = 500;
let nums = [];
for(let i = 0; i < 100; ++i) {
nums.push(String(num));
}
let num = 500;
let nums = [];
for(let i = 0; i < 100; ++i) {
nums.push(num.toString());
}
let num = 500;
let nums = [];
for(let i = 0; i < 100; ++i) {
nums.push(num + '');
}