RequestFX
RequestFX

Reputation: 37

JavaScript object gets sorted automatically

When I try to add an Object it just automatically sorts it, which I don't want

console.log(hwidList.csgo)

hwidList.csgo[hwidList.csgo.length] = { "HWID": 3267523467, "Name": "NewUser2", "ID": 34645674573464, "Date": "04/01/2021:22:47:59" };
console.log(hwidList.csgo)

It sorts it alphabetical

It sorts it alphabetical

Help please

Edit: Thanks for the help! It's the browser / console.log which shows it sorted but it isn't.

Image of it in terminal and it's not sorted

Upvotes: 1

Views: 572

Answers (1)

Harley Thomas
Harley Thomas

Reputation: 454

What browser are you using? For example, in Firefox, when calling console.log the result is printed alphabetically for your convenience. This issue has nothing to do with JavaScript or your code, it is the browser trying to help you in the instance you have very large objects.

Upvotes: 1

Related Questions