0

I need to reverse an object, and I try this:

        promises.push(
            post.once('value').then((snapshot2) => Object.assign(snapshot2.val(), { key: snapshot2.key }).reverse()
        ));

The problem is it gives me this error: Unhandled Rejection (TypeError): Object.assign(...).reverse is not a function

any ideas how to solve? Thanks.

RGS
  • 4,062
  • 4
  • 31
  • 67

1 Answers1

0

Object.assign() returns an Object, which does not have a reverse function. You could probably do something like this - How to reverse an object in javascript?

Hayden Linder
  • 393
  • 4
  • 10