javascript - why Object.getOwnPropertyNames for a DOM returns empty array? -


in following simplest html snippet:

<button class="clickme" id="clickme">click me</button> 

i use following javascript code query dom , want inspect properties , methods on objects returned getelementbyid:

var btn=document.getelementbyid('clickme');console.log(object.getownpropertynames(btn)); 

my question is: 1. why above log dumps out [] empty string?? 2. type of returned value getelementbyid?

thanks~!

  1. why above log dumps out [] empty string

all properties of object (element) inherited node, , own parent, eventtarget, , implements of parentnode, childnode, nondocumenttypechildnode, , animatable.

since has no direct property of own, returns empty array.

  1. what type of returned value getelementbyid?

it returns element.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -