`_.property` function on object using JavaScript Library underscore.js ( #shorts )
Hi Friends,
`_.property` function on object using JavaScript Library underscore.js
`_.property` function in Underscore.js library creates a function that returns the value of a specified property on an object. It is a easy way to get a specific property value from an object.
In below example, we create a function getName using _.property('name'). This function is now bound to the 'name' property. We then have an object person with properties like 'name' and 'age'. When we call getName(person), it retrieves the value of the 'name' property from the person object, which is "Annie".
Note: _.property function returns a new function that, when called with an object as its argument, retrieves the value of the specified property on that object.
// syntax
_.property(key)
// example
var getName = _.property('name');
var person = { name: 'Annie', age: 25 };
console.log(getName(person));
// "Annie"
#javascript #under #score #underscore #underscorejs #property #hastag #underscoreproperty #propertyfunction #unique #object #array #string #nodejs #javascriptinterview #method #js #jquery #function #shorts #viral #popular #latest #new #coders #development #code #dev #interview #php #trend #trending #answer #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`_.get` function on object using JavaScript Library underscore.js ( #shorts )
1 -
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:10
Pawanvir Singh Cheema
1 year ago`_.unzip` function on array using JavaScript Library underscore.js ( #shorts )
2 -
17:55
JoBlo Originals
21 hours agoWhat Happened to EPIC MEAL TIME?
17.7K4 -
31:02
Degenerate Plays
11 hours agoBest Girl Needs Her Swimsuit - Final Fantasy 7: Ever Crisis : Part 2
17K1 -
48:14
World Nomac
1 day agoMy First Time in Shanghai, China 🇨🇳
19.1K6 -
2:57:13
SNEAKO
11 hours ago"Who Do You Hate the Most?" - One Minute Podcast
92.2K89 -
4:47:25
SonnyFaz
7 hours agoDr. Shiva x Sonny IRL
52.4K17 -
4:28:03
LumpyPotatoX2
13 hours agoSub-Sunday on Rumble - #RumbleTakeover
64.7K4