Object.prototype.hasOwnProperty

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

Syntax

hasOwnProperty(name): boolean;

Parameters

Return value

true if the object has a property with the specified name; otherwise, false.

Examples

let obj = { temperature: 37 }
obj.hasOwnProperty("temperature")
true