Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Does Object.keys keep your insert order in JavaScript?

Assign the keys b , 2 , a , 1 to a plain object and Object.keys comes back as 1, 2, b, a . That is not a bug and it is not random: the spec splits keys into two groups and sorts one of them. The test const o = { } ; o . b = 1 ; o [ 2 ] = 2 ; o . a = 3 ; o [ 1 ] = 4 ; console . log ( Object . keys ( o ) ) ; // [ '1', '2', 'b', 'a' ] console . log ( JSON . stringify ( o ) ) ; //…

When assigning keys "b", 2, "a", and 1 to a plain JavaScript object, `Object.keys` returns the keys in the order of 1, 2, "b", "a". This behavior is intentional and not a bug; the specification divides keys into two groups and sorts one of them. The integer-like keys "1" and "2" are sorted in ascending numeric order, while the string keys "b" and "a" follow in the order they were inserted.

Integer keys, such as "01", "1.5", and "-1", are excluded from the integer group and remain in the string group. If relying on insertion order is crucial, consider using a Map, as it maintains the insertion order for all key types, including integer-like keys. In the provided examples, a plain object and a Map with the same keys were used to illustrate the difference in key ordering.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

More from Dev.to on urgent.news

Get the news by email. Yesterday's most-covered stories, every morning.

See today's edition · More options

More in Tech

When Enforcing TLS 1.3 Broke Our CI Builds

Originally published on Medium: https://medium.com/@seshikanthguduri/when-enforcing-tls-1-3-broke-our-ci-builds-d0b026e699eb The registry got more secure. The builds got red.

  • Enforcing TLS 1.3 on artifact registry broke CI builds
  • Registry tightened requirements to TLS 1.3, dropped older versions
  • Fix involved setting TLS client protocols and updating upload scripts

Building a CI/CD Pipeline on AWS: Deploying a Dockerized 2048 Game with CodePipeline, CodeBuild, ECR, and ECS Fargate

* By Rashid • Tags: aws, devops, docker, cicd * I built a complete CI/CD pipeline on AWS: every git push to GitHub now builds a Docker image and deploys it to the cloud automatically, with no manual…

  • CI/CD pipeline automates Dockerized 2048 game deployment on AWS
  • CodePipeline triggers CodeBuild to build Docker image in ECR
  • ECS Fargate deploys container without managed servers

More from Sunday, 6 December 2026 →