Use this function to sort the array in ascending order.

Syntax

sort(array)

Returns

Return ValueDescription
Array
Return the array in ascending order

Sample

sort (5, 2, 8, 1, 4): Return the output as (1, 2, 4, 5, 8)