You don&#x27;t need to do that. You just use a library.<p><pre><code>  import { isArrayLike, values } from &#x27;ramda&#x27;;
  
  const a = [];
  const aIsArray = isArrayLike(a);
  
  const d = {
    a: [1,2,3,],
    b:[4,5]
  };
  const dValues = values(d);
</code></pre>
Not to mention that a lot of the problems you mention have native solutions in ES6.<p>JavaScript is a very different language than the one people used to use 5 years back.