can anyone help me on how to retrieve function parameter names? For example:
var A = function(a, b, c) {};
I need to get the parameter name
Just to make complete @jerjer answer, We may also ensure there is at least one match:
function getFnParamNames(fn){ const match = fn.toString().match(/\(.*?\)/) return match ? match[0].replace(/[()]/gi,'').replace(/\s/gi,'').split(',') : []; }