Document Object Model(Objects)
Key difference between properties and methods of object(element)
Document object model contains elements in the form of objects.
Objects are categorized into two different parts
Properties
Methods
Let's take an example of a bus, so Imagine a picture of a bus. It has 4 tyres, 2 doors, it has some colour for example (green), it has a certain no of seats (70) etc.
All parameters given above are the (Properties) of the object called bus.
Let's take an example of the same bus, so Imagine a picture of a bus that is moving on a road from point A to B, applying breaks while stopping, accelerating again to gain speed, parked at a parking lot etc.
All parameters given above are the (Methods) of the object called bus.
Accessing (Properties) and (Objects) are common, we can access them using "." dot symbol.
Example - bus.color; (get property)
Example - bus.numberofDoors=0; (set property)
But the difference comes in when we assign values to properties called as (Set Property) and when we can take arguments in the called function.
Example - bus.drive(); (call method)
Example - bus.brake(); (call method)