Object.reverse

Object.reverse

Object.reverse

Function

Returns a new object with the key order reversed.

Syntax

Parameters

No parameters.

Return value

TypeDescription
ObjectReturns the new object value.

Return object fields

The returned object contains all outer fields of the original object, the field values maintain the original runtime reference semantics, and only the field insertion order is reversed.

Example

Notes

  • reverse does not modify the original object.
  • reverse only reverses the outer key order, and the value itself maintains runtime reference semantics; you can continue to call clone when independent data is needed.