JavaScript Node Types
Every computer programming language has a unique vocabulary and structure. Depending on what type of application you are building, you could use any variety or combination of languages in order to complete it. JavaScript is a common Web-scripting language that is used for a number of online purposes. The node is one element of the JavaScript language library.
-
Object-Oriented Programing
-
Object-oriented programming is a type of programming language that defines data, structures and functions. The purpose of this type of programming is the elimination of re-work. In other words, you can create functions and structures that can be referenced later within a code document. As an example, you could create a function that performs a very specific task, then reference that function later in the document without having to retype the code. This elimination of code redundancy is a huge time-saving tool.
JavaScript
-
JavaScript is an object-oriented programming language. It is commonly used in Web development and in conjunction with other markup languages such as HTML. Many of the interactive elements you come across online are created with the use of JavaScript. From buttons that change color when you roll over them to complex animations, JavaScript allows the programmer complete development freedom. JavaScript can be used bulk or in small bits to enhance an otherwise simple website.
-
JavaScript nodeType
-
Programming languages are designed with the understanding that the programmer will need to reuse components throughout a document. Object-oriented programming is built on this principal, and the nodeType assists in its completion. A node is a way of referencing the elements within a JavaScript program. Think of a node as a way of referencing a container that holds a specific type of information. Using JavaScript nodeTypes, you can reach back within your document and pull any information that meets the nodeType criteria.
nodeType Values
-
There are 12 possible JavaScript nodeTypes. Some common types are ELEMENT_NODE, TEXT_NODE, COMMENT_NODE and DOCUMENT_NODE. You can use JavaScript to determine which type of node your code is utilizing. You could achieve this by using the alert function in conjunction with the nodeType property. A value would return in an alert box when you visit the Web page using a browser. As an example, a value of "1" would indicate that you have accessed an ELEMENT_NODE and a value of "2" would indicate that you have accessed an ATTRIBUTE_NODE.
-
References
- Photo Credit Hemera Technologies/AbleStock.com/Getty Images