JSFiddle - React, Tailwind, and code Playground

JavaScript

var str = "01050";
var len=str.length;

var res = str.substring(0, len-2)+','+str.substring(len-2,len);
alert(res);