hasOwnProperty (RegExp - JavaScript)
Checks whether a string has a specified property.
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")
Have feedback?
Google Analytics is used to store comments and ratings. To provide a comment or rating for a topic, click Accept All Cookies or Allow All in Cookie Preferences in the footer of this page.