Skip to main content

reverse ()

Reverses a list in place. The first item becomes the last, and the last item becomes the first.

Parameters

$list
The list to reverse.
Type
List
$separator
The type of separator to be used by the reversed list.
Type
space | comma | slash | auto
Default
auto

Return Value

List
The reversed list.

Example

@use '@sass-fairy/list';

$list: 'ant', 'bison', 'camel', 'bison', 'duck', 'elephant';

@debug list.reverse($list);
// 'elephant', 'duck', 'bison', 'camel', 'bison', 'ant'