{"id":9613,"date":"2026-05-11T18:15:42","date_gmt":"2026-05-11T23:15:42","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=9613"},"modified":"2026-05-11T18:15:42","modified_gmt":"2026-05-11T23:15:42","slug":"arrays-objects-now-composites","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/arrays-objects-now-composites\/","title":{"rendered":"Arrays, objects&#8230; now \u2018composites\u2019?"},"content":{"rendered":"\n<p><a href=\"https:\/\/frontendmasters.com\/blog\/wp-admin\/post.php?post=9613&amp;action=edit\">Nice 9-minute video<\/a> from Matt Pocock (from about a year ago) introducing composites. The problem of not being able to compare objects definitely feels worth solving. Or, more accurately, fixing the issue where when compare two objects that look exactly the same, it&#8217;s still <code>false<\/code>. And that using them as keys doesn&#8217;t work. Sounds like Records &amp; Tuples were close, but the performance downsides were too strong. <a href=\"https:\/\/github.com\/tc39\/proposal-composites\">Composites<\/a> are more likely to happen.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const<\/span> pos1 = Composite({ <span class=\"hljs-attr\">x<\/span>: <span class=\"hljs-number\">1<\/span>, <span class=\"hljs-attr\">y<\/span>: <span class=\"hljs-number\">4<\/span> });\n<span class=\"hljs-keyword\">const<\/span> pos2 = Composite({ <span class=\"hljs-attr\">x<\/span>: <span class=\"hljs-number\">1<\/span>, <span class=\"hljs-attr\">y<\/span>: <span class=\"hljs-number\">4<\/span> });\nComposite.equal(pos1, pos2); <span class=\"hljs-comment\">\/\/ true<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Still <code>true<\/code> if you swap the order of the keys! Looks good to me. I don&#8217;t think it&#8217;s particularly close to making it into the language, but I see there is still <a href=\"https:\/\/github.com\/tc39\/proposal-composites\/issues\">discussion and research<\/a> going on.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nice 9-minute video from Matt Pocock (from about a year ago) introducing composites. The problem of not being able to compare objects definitely feels worth solving. Or, more accurately, fixing the issue where when compare two objects that look exactly the same, it&#8217;s still false. And that using them as keys doesn&#8217;t work. Sounds like [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9615,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29],"tags":[480,3],"class_list":["post-9613","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-the-beat","tag-composites","tag-javascript"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2026\/05\/pexels-photo-6991811.jpeg?fit=867%2C1300&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/9613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=9613"}],"version-history":[{"count":2,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/9613\/revisions"}],"predecessor-version":[{"id":9616,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/9613\/revisions\/9616"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/9615"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=9613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=9613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=9613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}