.sortBy(key)

Description

SortBy is a method that returns an array of values from an array

Parameters

SortBy takes a key as a parameter.

Usage On Arrays

arr = [{a:1},{a:2},{a:3}]
// setup the array

log arr.sortBy("a")
// returns [{a:1},{a:2},{a:3}]
// the array was sorted by the key "a"

Last updated

Was this helpful?