 <pre><code>var stuff= ["uyuuyu", "76gyuhj***", "uiyghj", "56tyg", "juijjujh***"]; for(var i = 0; i &lt; stuff.length; i++) { if(stuff[i].indexOf('***') != -1) { stuff[i] = stuff[i].replace('***','0') // this is where i guess the replacing would go } console.log(stuff[i]); } </code></pre>