- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to define methods for an Object in JavaScript?
Methods are the functions that let the object do something or let something is done to it. There is a small difference between a function and a method – at a function is a standalone unit of statements and a method is attached to an object and can be referenced by this keyword.
Methods are used for everything from displaying the contents of the object to the screen to performing complex mathematical operations on a group of local properties and parameters.
Here’s an example showing how to use the write() method of the document object to write any content on the document.
document.write("This is test");
- Related Articles
- How to add properties and methods to an object in JavaScript?
- How to add properties and methods to an existing object in JavaScript?
- How to add, access JavaScript object methods?
- JavaScript Object Methods
- How to define methods in C#?
- What are the methods of an array object in JavaScript?
- How to define custom methods in C#?
- How to define an Arrow Function in JavaScript?
- Is there a way to print all methods of an object in JavaScript?
- How to unflatten an object with the paths for keys in JavaScript?
- How to define rest parameter for a function in JavaScript?
- How to clone an object in JavaScript?
- How to freeze an Object in JavaScript?
- How to invert an object in JavaScript?
- How to access an object through another object in JavaScript?

Advertisements