Run details:
Mozilla/5.0 (Android 10; Mobile; rv:87.0) Gecko/87.0 Firefox/87.0
Firefox Mobile 87
Android
Mobile
3 years ago
Test name Executions per second
using plus operator 7026116.5 Ops/sec
using concat function 127239.8 Ops/sec
using template literals 1814723.0 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`;
    }