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


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

solved how to convert this code substr in php to javascript