I have a string that I need to split on a given index and then return both parts, seperated by a comma. For example:
string: 8211 = 8,211 98700 = 98,
Try this
function split_at_index(value, index) { return value.substring(0, index) + "," + value.substring(index); } console.log(split_at_index('3123124', 2));