0

I have this object structure in Javascript:

{
  2015-08:367,
  2015-09:381,
  2015-10:390,
  2015-11:400,
  2015-12:396,
  PAYOR:"PCP",
}

And need get this result:

{
  PAYOR:"PCP",
  2015-08:367,
  2015-09:381,
  2015-10:390,
  2015-11:400,
  2015-12:396,
}
pmkro
  • 2,542
  • 2
  • 17
  • 25

2 Answers2

0

Not a valid object, if you work with a valid array you have this https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice

KESO
  • 335
  • 2
  • 5
  • 17
0

Order of keys in JS objects is not guaranteed to be stable and can be implementation dependent. As pmkro said, don't use it

Markus
  • 1,598
  • 2
  • 13
  • 32