Lodash - prototype.reverse 方法



语法

_.prototype.reverse()

此方法是 _.reverse 的包装版本。

输出

  • (对象) - 返回新的 lodash 包装实例。

示例

var _ = require('lodash');  
var array = [1, 2, 3];
 
_(array).reverse().value();
 
console.log(array);

将以上程序保存在 tester.js 中。运行以下命令来执行此程序。

命令

\>node tester.js

输出

[ 3, 2, 1 ]
lodash_seq.htm
广告
© . All rights reserved.