<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="c" title="Order of Storing/Enumerating Keys in a JS Object">
<do type="prev" label="Back"><prev/></do>
<p><b>Order of Storing/Enumerating Keys in a JS Object</b><br/><small>14.07.2021</small></p>
<p>In JS, objects were &apos;unordered&apos; until ES5. Starting from ES6, there is a predictable order of iterating through an object&apos;s properties.</p>
<p>1. All non-negative integer keys less than 2^32, in ascending order. (e.g., &apos;1&apos;, &apos;79&apos;, etc.). Typically, all valid array indexes. (non-negative numbers up to 2^32)</p>
<p><i>&#160;&#160;<i>Warning</i>: &apos;05&apos; will not be considered an integer key, as the integer parsed from it yields a different string representation.</i></p>
<p>2. All string keys in the order of insertion (in the order they were added to the object).</p>
<p><i>&#160;&#160;Here, numeric strings not falling within the first step and floating-point numbers will be covered.</i></p>
<p mode="wrap">1/3 | <a href="/wap/eng/order_keys_in_js_objects-2.wml">Next &gt;&gt;</a><br/><a href="/wap/eng.wml">English</a><br/><a href="/wap/index.wml">Home</a></p>
</card>
</wml>
