reverse

reverse the UTF-16 code units of a string.

Usage

var reverse = require( '@stdlib/string/base/reverse' );

reverse( str )

Reverses the UTF-16 code units of a string.

var out = reverse( 'last man standing' );
// returns 'gnidnats nam tsal'

out = reverse( 'Hidden Treasures' );
// returns 'serusaerT neddiH'

out = reverse( 'foo bar' );
// returns 'rab oof'

Examples

var reverse = require( '@stdlib/string/base/reverse' );

var str = reverse( 'presidential election' );
// returns 'noitcele laitnediserp'

str = reverse( 'JavaScript' );
// returns 'tpircSavaJ'

str = reverse( 'The Last of the Mohicans' );
// returns 'snacihoM eht fo tsaL ehT'
Did you find this page helpful?