Object, Property, Method Flashcards
What is an object?
An object is a thing or entity in a programming context. Examples include the browser window, a submit button, or a web page document.
Give an example of objects in a web context.
Examples of objects in a web context include the browser window, the submit button on a form, and the entire web page document.
What is a property in programming?
A property is a characteristic or attribute of an object. For example, the background color of a web page (document.bgcolor) or the file last modified date (document.lastmodified).
Can you give an example of a property and how it is used?
An example of a property is img.src, which specifies the source file of an image object. You can both read or set the value of this property.
What is a method in programming?
A method is an action or function that an object can perform. It is like a verb that executes a specific action, such as writing text to a document (document.write()) or submitting a form (form.submit()).
Give an example of a method and what it does.
The method document.write() writes text to a web page document, and form.submit() submits a form.
What can you do with properties in JavaScript?
You can either read the value of a property (get its current state) or set a new value for the property (modify it).