I want to create string (delimited by pipe '||') from the contents of an array. I want to remover $ from the item and add || between two items. But I don't want to add || after the last array item. Easiest way to do this?
This is what I have done so far:
var array = ["$db1", "$db2", "$db3", "$db4"];
var dbs = "";
for(var i = 0; i < array.length, i++){
if(array[i].charAt(0) == "$"){
dbs += array[i].replace("$","") + "||";
alert(dbs);
}
}