4
I have a code snippet that searches a Json for the field called campo
, and inserts it into an array, which cannot have repeated values. My array always returned Undefined and it took me a while to find the error.
Why do JS and even IDE consider this valid? If campo
is an array, so it is obvious that after the .
would call a method. In the browser there was no error.
Code snippet wrong:
while (i < listaContatos.length) {
var dados = listaContatos[i].dados;
for (var j = 0; j < dados.length; j++) {
var nomeCampo = dados[j].campo;
console.log(nomeCampo);
if (campos.indexOf <= -1) {
campos.push(nomeCampo);
}
}
i++;
}
Related to your other question: http://answall.com/q/77107/132
– Victor Stafusa
@Victorstafusa did not understand why related
– Daniela Morais
It is not of the same functionality that you are developing from contact list?
– Victor Stafusa
I’m not saying they’re duplicates or anything, I’m just saying the other question has something to do with this.
– Victor Stafusa