Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/object/index.ts>hasOwn

A JavaScript extension package for building strong and modern applications.
Latest
function hasOwn
import { hasOwn } from "https://deno.land/x/ayonli_jsext@v0.9.72/object/index.ts";

Returns true if the specified object has the indicated property as its own property. If the property is inherited, or does not exist, the function returns false.

Examples

Example 1

import { hasOwn } from "@ayonli/jsext/object";

const obj = { foo: "hello" };

console.log(hasOwn(obj, "foo")); // true
console.log(hasOwn(obj, "toString")); // false

Parameters

obj: any
key: string | number | symbol

Returns

boolean