Underscore.js _.omit() function is used to return a copy of the object that was filtered to omit the blacklisted keys.
Syntax:
_.omit(object, *keys);Parameters:
- object: This parameter holds the value of an object.
- keys: It is an optional parameter. It contains the key name that the value needs to be omitted.
Return Value:
It returns a copy of the object that was filtered to omit the blacklisted keys.
Example 1: In this example, we are using the Underscore.js _.omit() function.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src=
"https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js">
</script>
</head>
<body>
<script type="text/javascript">
let info = {
Company: 'GeeksforGeeks',
Address: 'Noida',
Contact: '+91 9876543210'
};
console.log(_.omit(info, 'Company', 'Address'));
</script>
</body>
</html>
Output:

Example 2: In this example, we are using the Underscore.js _.omit() function.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src=
"https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js">
</script>
</head>
<body>
<script type="text/javascript">
let info = {
key1: 10,
key2: 20,
key3: 30,
key4: 40,
key5: 50
};
console.log(_.omit(info, function (value, key, info) {
return value == 10 || value == 50;
}));
</script>
</body>
</html>
Output: