- First, get the function’s code to its string equivalent using toString() method.
- Then remove all the unnecessary codes like comments, function body, white spaces and ES6 arrow (if any).
- Identify the first occurrence of ‘(‘, it will be just before the starting of parameters.
- The last character of the string will be ‘)’ which remove all comments, function body, white spaces, and ES6 arrow.
- Also, the last character will be just after the end of the parameters.
List of parameters: List of parameters of fun1: [ 'a' ] List of parameters of fun2: [ 'a', 'b' ] List of parameters of fun3: [ 'a', 'b', 'c' ]