Skip to content
Subhajit Sahu edited this page Dec 8, 2022 · 6 revisions

Check if object has a key.

Similar: has, hasValue, hasEntry, hasSubset, hasPath.
Similar: keys, has, randomKey.
Similar: keys, values, entries.


function has(x, k)
// x: an object
// k: search key
const object = require('extra-object');

var x = {a: 1, b: 2, c: -3};
object.has(x, 'd');
// → false

object.has(x, 'c');
// → true


References

Clone this wiki locally