A very basic question, but I can't find the solution :
I have a jquery object (given in console.log
):
{
id_ship: "1",
id_company: "1",
code: "DE",
// other properties...
}
I just want to get the first key on the object. In this case, i want to obtain id_ship
Thank you in advance
As @RoryMcCrossan has said, the order in object is not guranteed. But if you still want to get first key you can use:
Object.keys(obj)[0];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With