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.