I have this array:
var distanciaCentroUltimo = [790,850];
var tamaño = 2455;
by means of a for, how do I make the following?
2455-790-850 = 815
I have this array:
var distanciaCentroUltimo = [790,850];
var tamaño = 2455;
by means of a for, how do I make the following?
2455-790-850 = 815
Example of how to sequentially read a array through a for
:
var distanciaCentroUltimo = [790,850];
var tamaño = 2455;
for ( n in distanciaCentroUltimo) {
tamaño -= parseInt(distanciaCentroUltimo[n]);
};
console.log(tamaño);
The result is 815 and not 4100