`_.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
CAMELOT331
1 hour agoWatching HURRICANE Milton & Asking For Businesses To Step Up LIVE
1,853 watching -
24:02
Stephen Gardner
1 hour ago🔴Kamala CRASHES AND BURNS On 60 Minutes interview + Hurricane Milton Warning!
4.52K34 -
4:57:57
Right Side Broadcasting Network
1 day agoLIVE: President Trump Participates in an October 7th Remembrance Event - 10/7/24
160K75 -
1:47:12
Kim Iversen
5 hours agoWhat Has Hamas and Israel Really Achieved Since Oct 7th? | More Creators Ripped Off YouTube For “Hate Speech"
29.7K32 -
6:34
Colion Noir
3 hours agoCan You Shoot Someone Attacking You With A Shovel? The Truth About Deadly Force
13K18 -
1:34:33
Glenn Greenwald
6 hours agoOct. 7: Whose Lives Matter Most & Least In The Middle East? Hillary Latest Dem To Demand Online Censorship | SYSTEM UPDATE #348
58.3K127 -
1:07:48
Donald Trump Jr.
10 hours agoSpeak Up America, Interview with Comedian Rob Schneider | TRIGGERED Ep.180
115K140 -
LIVE
We Like Shooting
13 hours agoWe Like Shooting 579 (Gun Podcast)
346 watching -
0:19
TheMonicaCrowleyPodcast
7 hours agoTOMORROW OCTOBER 8th VICE PRESIDENT CANDIDATE JD VANCE JOINS THE MONICA CROWLEY PODCAST
5.93K -
53:47
LFA TV
1 day agoTrump’s Triumphant Return to Butler | Trumpet Daily 10.7.24 9PM EST
15.6K4