filmov
tv
`_.omit` function on object using JavaScript Library underscore.js ( #shorts )

Показать описание
Hi Friends,
In below example, we have an object person that represents a person's details. We use _.omit to exclude the age and profession properties from the person object. The variable omittedProps is a new object that contains all properties from the person object except age and profession.
Note: You can pass multiple property keys as arguments to _.omit, and it will create a new object without those properties if they exist in the source object.
// syntax
_.omit(object, *keys)
// example
var person = { name: "Alice", age: 25,
city: "New York", profession: "Engineer"};
var omittedProps = _.omit(person, "age", "city");
// { name: "Alice", profession: "Engineer"}
#javascript #under #score #underscore #underscorejs #omit #underscoreomit #omitfunction #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
In below example, we have an object person that represents a person's details. We use _.omit to exclude the age and profession properties from the person object. The variable omittedProps is a new object that contains all properties from the person object except age and profession.
Note: You can pass multiple property keys as arguments to _.omit, and it will create a new object without those properties if they exist in the source object.
// syntax
_.omit(object, *keys)
// example
var person = { name: "Alice", age: 25,
city: "New York", profession: "Engineer"};
var omittedProps = _.omit(person, "age", "city");
// { name: "Alice", profession: "Engineer"}
#javascript #under #score #underscore #underscorejs #omit #underscoreomit #omitfunction #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