Run details:
Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-G781B) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/14.2 Chrome/87.0.4280.141 Mobile Safari/537.36
Chrome Mobile 87
Android
Mobile
3 years ago
Test name Executions per second
using plus operator 38693.6 Ops/sec
using concat function 33443.8 Ops/sec
using template literals 37885.9 Ops/sec
Script Preparation code:
AخA
 
var name = "name";
var id = "id";
Tests:
  • using plus operator

     
    for (let i = 0; i < 80; ++i) {
      let result = id + ": 1, " + name + ": someItem";
    }
  • using concat function

     
    for (let i = 0; i < 80; ++i) {
      let result = "".concat(id, ": 1, ", name, ": someItem");
    }
  • using template literals

     
    for (let i = 0; i < 80; ++i) {
      let result = `${id}: 1, ${name}: someItem`;
    }