[Solved] how to convert this code substr in php to javascript

[ad_1]

This seems to work:

const str="XII-14";
const next = 123;
const text1 = '00000000001' + next;
const len = 6;
console.log(str + text1.substr(-len));

It returns:

XII-14001123

[ad_2]

solved how to convert this code substr in php to javascript