Answer the question
In order to leave comments, you need to log in
js how to iterate over an array?
There is an array
ports = [];
I fill it with lines (using lodash):
_.each(data.ports_variables, function(val){
ports.push(val.ifName);
})
console.log(ports[0]);
->undefined
console.log(ports);
Answer the question
In order to leave comments, you need to log in
Perhaps you are iterating in a callback to some kind of asynchronous function? request type
Everything is working fine, you are doing something wrong
https://jsfiddle.net/rxLomLLw/
Why is Array.prototype.forEach bad? Everyone forgot about the good old for ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question