Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js replace character in string index

str = 'INPUT HERE'
str = str.split('');
str[3] = 'O';
str = str.join('');
//Output: INPOT HERE

//Why does 3 replace the fourth character?
//Almost all rogramming languages start to count from zero.
//0 = first, 1 = second...
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #replace #character #string #index
ADD COMMENT
Topic
Name
4+5 =