can someone help me with this, i have a string.... var key=''; key+='aaabacadag'; Code (markup): i want to make it like this ?aa?ab?ac?ad?ag Code (markup): TIA.
Here is what you want: var key=''; var str = 'aaabacadag'; for(var i=0; i<str.length; i++){ if(i%2==0){ key += "?"; } key += str.substr(i,1); } Code (JavaScript):