When iterating JavaScript object retrieves different values than shown when console.logged complete object

9 hours ago 1
ARTICLE AD BOX

I'm working with and object than has several keys of payways for a sales invoice, when I do console.log before starting to iterate I receive:

[ { "importe": 20000, "idformapago": "45", "ajuste": -2000, "precio": 18000, "cargo": "-10", "dolar": 0 }, { "importe": 20, "idformapago": "74", "ajuste": 29000, "precio": 29000, "cargo": "0", "dolar": 1 } ]

But when iterating each key the second sends 0 in some keys: First every key identical:

{ "importe": 20000, "idformapago": "45", "ajuste": -2000, "precio": 18000, "cargo": "-10", "dolar": 0 }

Second gets "ajuste" and "precio" with zero:

{ "importe": "20", "idformapago": "74", "ajuste": 0, "precio": 0, "cargo": "0", "dolar": 1 }

This is the code I use :

console.log(formaspago); Object.keys(formaspago).forEach(function(index){ console.log(index); console.log(formaspago[index]); });

All the keys of the object are populated with the same routine. Any ideas?

Read Entire Article