Test name | Executions per second |
---|---|
using plus operator | 89715.0 Ops/sec |
using concat function | 76829.0 Ops/sec |
using template literals | 87498.7 Ops/sec |
var name = "name";
var id = "id";
for (let i = 0; i < 80; ++i) {
let result = id + ": 1, " + name + ": someItem";
}
for (let i = 0; i < 80; ++i) {
let result = "".concat(id, ": 1, ", name, ": someItem");
}
for (let i = 0; i < 80; ++i) {
let result = `${id}: 1, ${name}: someItem`;
}