.reverse()

Description

The method ".reverse()" reverses the order of strings and arrays

Parameters

Reverse takes no parameters

Usage On Arrays

arr = [1,2,3,4,5]
// setup the array

log arr.reverse()
// returns [5,4,3,2,1]

Usage On Strings

str = "hello"
// setup the string

log str.reverse()
// returns "olleh"

Last updated