Javatpoint Logo
Javatpoint Logo

JavaScript Object.getOwnPropertyNames() Method

The Object.getOwnPropertyNames() method returns an array of all properties (except those non-enumerable properties which use symbol) found directly upon a given object.

Syntax:

Parameter:

obj: It is the object whose enumerable and non-enumerable own properties are to be returned.

Return value:

This method returns an array of string that correspond to the properties found directly upon the object.

Browser Support:

Chrome 5
Edge Yes
Firefox 4
Opera 12

Example 1

Output:

["a", "b", "c"]

Example 2

Output:

["0", "1", "2"]
 "0 -> a"
 "1 -> b"
 "2 -> c"    

Example 3

Output:

size,shape

Next TopicJavaScript Objects





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA