string insert character at position javascript code example
Example 1: js insert string at position
var a = "I want apple";
var b = " an";
var position = 6;
var output = [a.slice(0, position), b, a.slice(position)].join('');
console.log(output);
Example 2: add char in specific index stirng javascript
int j = 123456;
String x = Integer.toString(j);
x = x.substring(0, 4) + "." + x.substring(4, x.length);
//output : 1234.56