Menu
Here is my array:
var cars = [“BMW|2”, “Volvo|2″,”Saab|3”, “Ford|1”, “Fiat|1”, “Audi|1”];
I need to go through the array and split the array by “|” and rename the array element zero based on array element 1
Example: “BMW|2” i need to rename this to: BMW_1,BMW_2
“Saab|3” i need to rename this to: Saab1,Saab2,Saab3
So I am looking for guidance and `directions
`var cars = [“BMW|2”, “Volvo|2″,”Saab|3”, “Ford|1”, “Fiat|1”, “Audi|1”];
var text = “”;
for (var i = 0; i < cars.length; i++) {
text += cars[i] + “,” ;
//gs.log(“test”);
}
gs.log(text); //BMW|2,Volvo|2,Saab|3,Ford|1,Fiat|1,Audi|1
`