Sorry to nitpick, but indexOf is a bad idea. Using it is up to 1700x slower (worst case) than using object indices[1]. It&#x27;s probably an O(n) operation, where indexing an Object is nearly always O(1).<p>1: <a href="https:&#x2F;&#x2F;jsperf.com&#x2F;indexof-vs-object-lookup&#x2F;4" rel="nofollow">https:&#x2F;&#x2F;jsperf.com&#x2F;indexof-vs-object-lookup&#x2F;4</a>