0

I have been searching for an option to display a list of methods in a JavaScript file. Are there any methods to pass a JavaScript file name in a for loop, and then to display the function names from the JavaScript file?

I am having list of javascript files, in each of js files, there are various functions. I want to display list of method names in browser window.

For example,if there are 2 functions in arithmetic.js file.

function add(){
}
function subtract(){
}

Then, in an html file, i want to display those two method names such as add, subtract..

1

2 Answers 2

0

i dont think there is a simple way to this , if this is your files write a function inside every file that return the name of the function

Sign up to request clarification or add additional context in comments.

Comments

0

Answer to this has already been given by @Kooilnc, to see it follow below link

Reflection in Javascript

It displays all functions names of browser page pls check the below link http://www.w3schools.com/code/tryit.asp?filename=F0VB7DGKT3DX

1 Comment

I have checked this, but it returns the browser windows methods and the methods inside the script tag of html file. I am having js file seperately. I want to display list of methods from that particular js file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.