Commonly used properties in JavaScript

Commonly used attributes in JavaScript include the following:

  1. length: Returns the length of a string or array.

  2. prototype: The prototype chain used to add properties and methods to objects.

  3. constructor: Returns the constructor of the object.

  4. window: represents the current window or global object.

  5. document: represents the current document object.

  6. innerHTML: Set or return HTML content.

  7. innerText: Set or return text content.

  8. value: Set or return the value of the element.

  9. style: used to set the style of the element.

  10. className: Sets or returns the class name of the element.

  11. id: Set or return the ID of the element.

  12. src: Set or return the path of the image or script.

  13. href: Set or return the address of the link.

  14. name: Sets or returns the name of the element.

  15. parentNode: Returns the parent node.

  16. childNodes: Returns a collection of child nodes.

  17. nextSibling: Returns the next sibling node.

  18. previousSibling: Returns the previous sibling node.

  19. tagName: Returns the tag name of the element.

  20. offsetWidth, offsetHeight: Return the width and height of the element.

These are just some of the commonly used properties, there are many other properties that can be used in JavaScript.

Guess you like

Origin blog.csdn.net/m0_74801194/article/details/135225939