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..

Shamu
  • 158
  • 1
  • 5
  • Possible duplicate of [Return all of the functions that are defined in a Javascript file](http://stackoverflow.com/questions/11279441/return-all-of-the-functions-that-are-defined-in-a-javascript-file) – jacefarm Nov 17 '16 at 07:25

2 Answers2

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

Community
  • 1
  • 1
PassionInfinite
  • 640
  • 4
  • 14
  • 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. – Shamu Nov 17 '16 at 07:26
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

Developer
  • 460
  • 4
  • 17