Method arrayFromProp documentation

Creates and returns a new array made of the given property's values from the given array of objects.

Example

```javascript bbn.fn.arrayFromProp([ {movie: "Brazil", year: 1985}, {movie: "Donnie Darko", year: 2001}, {movie: "Barry Lindon", year: 1976} ], "year"); // [1985, 2001, 1976] ```

Example

```javascript bbn.fn.arrayFromProp([ {pupil: "Agnes Varda", grade: {year: "B", month: "A"}}, {pupil: "Jacques Rivette"}, {pupil: "Luc Besson", grade: {year: "C", month: "D"}}, {pupil: "Nicole Garcia", grade: {year: "B", month: "B"}} ], "grade.month"); // ["A", undefined, "D", "B"] ```

Creates and returns a new array made of the given property's values from the given array of objects. - The returned array will always have the same length of the given array, even if the property is not found. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.