Brief explanation about some terms
Method: A method is a function that is associated with an object in JavaScript. Methods can be used to perform actions on the object or retrieve information from the object. For example, the
getElementById
method is a method that is associated with thedocument
object and is used to retrieve an HTML element from the DOM.Element: An element is an object in the DOM that represents an HTML tag. Elements can have properties (such as
textContent
andclassName
) and can be modified using methods (such assetAttribute
andappendChild
). Examples of elements include<div>
,<p>
, and<img>
tags.Properties: In JavaScript, properties are values associated with an object. Elements in the DOM are objects and have properties such as
textContent
,className
, andid
. Properties can be accessed and modified using dot notation, such aselement.textContent = 'Hello World';
.Attribute: An attribute is a value that is associated with an HTML tag. Attributes are used to provide additional information about an element, such as the
src
attribute on an<img>
tag. Attributes can be accessed and modified using methods such asgetAttribute
andsetAttribute
.
Last updated