Having some trouble removing the double quotes character from my data. I know this question gets asked a lot but I cant find an answer that helps...
I have an array of data which contains objects. Each object has strings that look like this (taken from Chrome DevTools):
0: Object
coID: 1
country: "ireland"
email: "email"
history: "history line 1<br>history line 2<br>history line 3<br>history line 4"
name: "My Company"
phone: "0872780000"
1: Object
coID: 2
country: ""ireland""
email: ""email@mail.com""
history: ""history line 1"<br>"history line 2"<br>"history line 3"<br>"history line 4""
name: ""Other Company""
phone: ""0872780000""
As you see the second object has double quotes all over the place. To remove them, I tried this:
// replace any instances of the quotes character.
for(m=0; m<listOfCompanies.length; m++) {
for(n=0; n<listOfCompanies[m].length; n++) {
dataIn[m][n].replace(/\"/g,'');
}
}
It doesn't do anything though, and the quotes remain intact in the second object.
And also this (from Matt S):
// replace any instances of the quotes character.
for(m=0; m<listOfCompanies.length; m++) {
for(n=0; n<listOfCompanies[m].length; n++) {
dataIn[m][n] = dataIn[m][n].replace(/\"/g,'');
}
}
Am I able to use this method for this type of data? or am I doing something wrong?