ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
## tap + [link](./tap "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L7190 "View in source.") + [npm](https://www.npmjs.com/package/lodash.tap "See the npm package.") ``` _.tap(value, interceptor) ``` 这个方法调用一个 `interceptor` 并返回 `value`。`interceptor` 传入一个参数:(value) 目的是 `进入` 链的中间以便执行操作。 ### 参数 1. value (\*) 提供给 `interceptor` 的值 2. interceptor (Function) 调用函数 ### 返回值 (\*) 返回 `value` ### 示例 ``` _([1, 2, 3]) .tap(function(array) { // 改变传入的数组 array.pop(); }) .reverse() .value(); // => [2, 1] ```