pluck()

Creates a copy of the given array making each item the value of the given property name.

This function is valid in v2.0.0 to v2.23.0. This function has been downloaded 32 times.

Parameters

{Array} arr
Array to copy.
{string|number} propName
Name of the property of each array item that will replace the corresponding array item. If this is a negative number and the array items are arrays this will be used as the index counting from the end of those arrays.

Returns

{Array}
Copy of arra where each item is replaced by one of its properties as specified by propName.

Required Function

This function directly requires the following function which is included automatically:

  • has()
    Every object descended from Object inherits the hasOwnProperty method. This method can be used to determine whether an object has the specified property as a direct property of that object; unlike the in operator, this method does not check down the object's prototype chain.