欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

获取Function的参数名称

程序员文章站 2024-02-17 22:24:16
...
function getParamNames (fn) {
  return fn.toString()
           .match(/^function\s*[^\(]*\(([^\)]*)\)/)[1]
           .replace(/,\s+/gi,',')
           .split(',');
  }
}


转载于:https://my.oschina.net/tommyfok/blog/304759