Am I being stupid here? (I'm coming from Ruby, so there might be something about Javascript arrays that I'm missing).
console.log(new_devices)
Result in console: Array[1]
.
console.log(new_devices.length)
Result in console: 0
The code producing this:
var sp = require('serialport');
var new_devices = [];
sp.list(function(err, ports) {
ports.forEach(function(current) {
if (current.manufacturer == "Teensyduino") {
new_devices.push(current);
}
});
});
console.log(new_devices);
console.log(new_devices.length);