
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Is there a way to print all methods of an object in JavaScript?
To get all the method, use Object.getOwnPropertyNames(). This returs all properties that belong to an object.
Example
You can try to run the following code to get all methods −
<!DOCTYPE html> <html> <body> <script> document.write("<br>"+Object.getOwnPropertyNames(Math).filter(function (p) { return typeof Math[p] === 'function'; })); </script> </body> </html>
- Related Questions & Answers
- Is there any way to check if there is a null value in an object or array in JavaScript?
- Is there an elegant way of passing an object of parameters into a function?
- Get all methods of any object JavaScript
- Is there an easy way to rename a table in a MySQL procedure?
- Is there a way to list collections in MongoDB?
- Is there a way to name columns in an INSERT statement in MySQL?
- Is there a way to find an element by attributes in Python Selenium?
- Is there any way to use values from a JSON object in a MySQL Select statement?
- Is there any way to embed a PDF file into an HTML5 page?
- JavaScript Object Methods
- How to define methods for an Object in JavaScript?
- What is the most efficient way to deep clone an object in JavaScript?
- What are the methods of an array object in JavaScript?
- Is there a way to retrieve the minimum value of fields in MySQL?
- Is there a way to subtract number of days from a date in MySQL?
Advertisements