increment in the last integer indexof string in javascripts code example
Example: auto increment string in javascript
function autoIncrementCustomId(lastRecordId){
let increasedNum = Number(lastRecordId.replace('ABC','')) + 1;
let kmsStr = lastRecordId.substr(0,3);
for(let i=0; i< 6 - increasedNum.toString().length; i++){
kmsStr = kmsStr+'0';
}
kmsStr = kmsStr + increasedNum.toString();
console.log(kmsStr);
}
autoIncrementCustomId('ABC009999')