Function hasOwnProperty

  • Determines whether an object has a property with the specified name.

    Parameters

    • obj: object

      The object to check for properties.

    • keys: string

      The keys to check for in the object, separated by commas.

    • Optional returnType: boolean = false

      Determines the return type of the function. Defaults to false.

    Returns string | boolean

    • If returnType is true, returns a boolean value indicating whether all keys were found in the object. If returnType is false, returns a string indicating whether all keys were found or which keys were not found.

    Example

    console.log(hasOwnProperty({'a':1, 'b':2, 'c':3}, "a,d"));
    // Output: "d not found"

Generated using TypeDoc