ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
## methodOf + [link](./methodOf "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L13425 "View in source.") + [npm](https://www.npmjs.com/package/lodash.methodof "See the npm package.") ``` _.methodOf(object, [args]) ``` 反向版 `_.method`。 这个创建一个函数调用给定 `object` 的 `path` 上的方法, 任何附加的参数都会传入这个调用函数中。 ### 参数 1. object (Object) 要检索的对象 2. [args] (...*) 传递给调用函数的参数 ### 返回值 (Function) 返回新的函数 ### 示例 ``` var array = _.times(3, _.constant), object = { 'a': array, 'b': array, 'c': array }; _.map(['a[2]', 'c[0]'], _.methodOf(object)); // => [2, 0] _.map([['a', '2'], ['c', '0']], _.methodOf(object)); // => [2, 0] ```