I have array structure like this:
array[1].name = "parameter-name";
array[1].value = null;
array[2].name = null;
array[2].value = "parameter-value2";
i want to change null to "".
This is how I display in ajax:
for (var i in array) {
if(array[i].name == null) {
array[i].name = "";
}
if(array[i].value == null) {
array[i].value = "";
}
}
How to make if condition all item of the array?
for (var i in array) {
if(array[i] == null) {
array[i] = "";
}
}
I tried this but the result is error on JavaScript.
array[i]nameis not going to work. Why don't you fix that first. Just out of curiosity, why do want to replacenullwith an empty string?