pretty basic question I think, but I couldn't find info on that.
Through d3 I parse a csv and each object look like this
name: "whatever"
number: "52"
How can I access the array of all the properties "number" as an array without creating a new array and pushing each element?
ES6 version:
const numbers = objects.map( o => o.number );
Enjoy.
Use array.map:
var numbers = objects.map(function(o) { return o.number; });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With