Premium Only Content

`_.where` function on array using JavaScript Library underscore.js ( #shorts )
Hi Friends,
`_.where` function on array using JavaScript Library underscore.js
`_.where` is a utility function in Underscore.js library that allows you to filter a collection based on multiple key-value pairs. It returns an array of all objects from the collection that match the specified properties.
In below example, we have an array of user objects users. We use _.where to filter the collection and retrieve all objects that have the property city set to "London". The result, filteredUsers, is an array containing the user objects that match the specified key-value pair.
Note: _.where returns an array containing all objects from the collection that match the specified key-value pairs.
// syntax
_.where(list, properties)
// example
var users = [
{ name: "Alice", age: 25, city: "New York" },
{ name: "Bob", age: 30, city: "London" },
{ name: "Charlie", age: 20, city: "Paris" },
{ name: "David", age: 35, city: "London" }
];
var filteredUsers = _.where(users, { city: "London" });
console.log(filteredUsers);
// [{ name: "Bob", age: 30, city: "London" },
// { name: "David", age: 35, city: "London" }]
#javascript #under #score #underscore #underscorejs #findWhere #findwhere #find #where #underscorefindwhere #findwherefunction #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