If I have a string and a number:
var str='Thisisabigstring';
var numb=7;
I'm trying to remove the character at position 'numb' from the string and then put it at the beginning of the string.
Trying for output like:
'aThisisbigstring';
How can I do this with javascript/jquery?
var str = "Thisisabigstring";
var numb=7;
var c = str.charAt(numb);
str = c + str.substr(0, numb) + str.substr(numb + 1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With