主题
_.prototype.next()
_.prototype.next() 方法用于获取链式调用中的下一个值。
返回值
- 下一个值。
示例
javascript
const users = [
{ user: "barney", age: 36 },
{ user: "fred", age: 40 },
];
const chain = _(users).chain().head().pick("user");
const nextValue = chain.next();
// => { 'user': 'barney' }
console.log(nextValue); // 输出:{ 'user': 'barney' }在这个示例中,_.prototype.next() 方法从链式调用中获取了下一个值,并返回该值。