`_.pluck` function on array using JavaScript Library underscore.js ( #shorts )
Hi Friends,
`_.pluck` function on array using JavaScript Library underscore.js
`_.pluck` is a utility function in Underscore.js library that allows you to extract a specific property value from each object in an array of objects. It simplifies the process of retrieving a particular property from multiple objects.
In below example, we have an array of objects students, where each object represents a student with properties such as name and age. We use _.pluck to extract the name property from each object, and the resulting names array contains the names of the students.
Note: starting from Underscore.js version 1.8.0, the _.pluck function has been deprecated in favor of the _.map function with a property shorthand.
// syntax
_.pluck(list, propertyName)
// example
var students = [
{ name: "Alice", age: 20 },
{ name: "Bobby", age: 22 },
{ name: "Charlie", age: 21 }
];
var names = _.pluck(students, "name");
console.log(names);
// ["Alice", "Bobby", "Charlie"]
#javascript #under #score #underscore #underscorejs #underscorepluck #pluckfunction #pluck #object #array #string #nodejs #javascriptinterview #method #js #jquery #function #shorts #viral #popular #latest #new #coders #development #code #dev #interview #php #trend #trending #answer #best #free #laravel #youtube #instagram #socialmedia #education #edit #how #india #knowledge #quiz #reels #short #subscribe #share #update #video #web #webdeveloper #website #webdesign #ytshorts #youtuber #princecheema_official @princecheema_official
-
0:10
Pawanvir Singh Cheema
1 year ago`_.unzip` function on array using JavaScript Library underscore.js ( #shorts )
2 -
0:10
Pawanvir Singh Cheema
1 year ago`_.clone` function on object or array using JavaScript Library underscore.js ( #shorts )
11 -
0:10
Pawanvir Singh Cheema
1 year ago`_.range` function on array using JavaScript Library underscore.js ( #shorts )
8 -
0:59
Pawanvir Singh Cheema
1 year agoJavaScript convert An Object into An Array ( #shorts )
23 -
0:10
Pawanvir Singh Cheema
1 year ago`_.reject` function on array using JavaScript Library underscore.js ( #shorts )
3 -
0:10
Pawanvir Singh Cheema
1 year ago`_.get` function on object using JavaScript Library underscore.js ( #shorts )
1 -
5:43
EasilyCoded
1 year ago"Must know Array Methods" splice() and slice() methods in JavaScript
55 -
4:01
FreelanceMogul
6 months agoHow to Shuffle a JavaScript Array using the Fisher-Yates (also known as Knuth)
4 -
33:06
Hogster Studio Design
1 year agoCreate Object Array Function Script
2 -
6:41
NorbertBM
1 year ago $0.01 earnedAll JavaScript Array Methods for Beginners
66