Premium Only Content

`_.has` function on object using JavaScript Library underscore.js ( #shorts )
Hi Friends,
`_.has` function on object using JavaScript Library underscore.js
`_.has` is a utility function in Underscore.js library that allows us to check if an object contains/has a specific property regardless of the property's value.
In below example, we have an object person that has a person's details. We use _.has to check if the person object has the properties "name" and "phone". The first call to _.has returns true because the person object has the "name" property. The second call returns false because the person object does not have the "phone" property.
Note: _.has can be useful when we want to conditionally access or manipulate a property only if it exists in the object.
// syntax
_.has(object, key)
// example
var person = { name: "Annie", age: 25, city: "New York" };
console.log(_.has(person, "name"));
// true
console.log(_.has(person, "phone"));
// false
#javascript #under #score #underscore #underscorejs #has #hastag #underscoreget #getfunction #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
-
LIVE
The Quartering
1 hour agoRFK Jr Goes NUCLEAR, Horrible Tomb Raider News, Anti-White Male Propaganda
9,922 watching -
LIVE
Dr Disrespect
4 hours ago🔴LIVE: Hell Is Us Launch - DR DISRESPECT’s First Look at the Scariest Game of 2025!
1,608 watching -
LIVE
Pop Culture Crisis
1 hour agoSabrina Carpenter Wants Feminist Approval, Demonic Rituals at Burning Man? | Ep. 910
496 watching -
11:17
Dr. Nick Zyrowski
29 days agoTop 10 No CARB No SUGAR Foods That Will Change Your Health
1.46K2 -
1:52:45
John Burk
2 hours agoThe Texas Hemp ban, DOJ removing guns from trans, and more.
3091 -
1:05:37
LindellTV
1 hour agoMike Lindell Debates Democrats in the Streets of DC
3.33K1 -
7:49
Talk Nerdy Sports - The Ultimate Sports Betting Podcast
3 hours agoTNF BEST BETS: Eagles vs Cowboys | 10 Props & Same-Game Parlays (Sept 4, 2025)
7 -
LIVE
Anthony Rogers
3 hours agoProbably the best Fortnite stream
38 watching -
47:48
The White House
6 hours agoFirst Lady Melania Trump Hosts a Meeting of the White House Task Force on AI Education
15.3K26 -
1:27:12
Sean Unpaved
2 hours agoThursday Night Thrills & Kawhi's No-Show Gig in LA
13K1