`_.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
-
54:46
RealitySurvival
2 hours agoWW3 Has Begun! Global Prepper SITREP - Russia and China and Iran Oh MY!
5.55K2 -
DVR
Quite Frankly
8 hours ago"Declaration Day & Wide Open Lines" 7/2/24
16.3K12 -
59:47
Stephen Gardner
4 hours ago🔴 Ex-CIA: Putin THREATENS Biden after US Guided Attack on Russia - Ukraine messed up!!
28K85 -
2:04:30
vivafrei
8 hours agoSCOTUS Immunity Ruling! Dems in Full Projection Mode! Biden Has Always Been Evil AND MORE! Viva Frei
76.6K177 -
1:16:11
Andy Frisella
9 hours agoHow The Debate Debacle Could Impact Voters - Ep 736 CTI
26.1K3 -
29:53
justintech
6 hours agoBest Meta Quest 3 Accessories! - The ULTIMATE VR Review!
17.7K1 -
7:15
Chrissy Clark
1 day agoPolice Redefine N*dity Laws For Pride Parade
26.3K43 -
1:07:20
Battleground with Sean Parnell
7 hours agoDemocrat Dilemma
37.2K26 -
18:21
TENET Media
6 hours agoWhat Will The Future Under Trump Look Like? | Benny Johnson & Lara Trump
27.8K17 -
1:00:55
Lee Camp
7 hours agoLIVE: A Festival of Psy-Ops — We Live in A False Reality!
44.2K