Remove a character at a certain position in a string - javascript
It depends how easy you find the following, which uses simple String methods (in this case slice()
).
var str = "Hello World";
str = str.slice(0, 3) + str.slice(4);
console.log(str)
You can try it this way:
var str = "Hello World";
var position = 6; // its 1 based
var newStr = str.substring(0, position - 1) + str.substring(position, str.length);
alert(newStr);
Here is a live example: http://jsbin.com/ogagaq