hasOwnProperty (RegExp - JavaScript)

Checks whether a string has a specified property.

Defined in

RegExp (Standard - JavaScript)

Syntax

hasOwnProperty(property:string) : boolean
Parameters Description
property The name of a property.
Return value Description
boolean True if the object has the property; otherwise false.

Examples

This example returns true or false for three properties.
var regexp = /(Moscow)/;
return "constructor = " + regexp.hasOwnProperty("constructor") +
	"\nlength = " + regexp.hasOwnProperty("length") +
	"\nprototype = " + regexp.hasOwnProperty("prototype")