title: Check if object is iterable
body: <pre><code>const [, segment1, segment2] = &quot;string&quot;.match(/([^/]+)\/(.*)/);
  </code></pre>
  <p>returns object null is not iterable (cannot read property Symbol(Symbol.iterator))</p>
  <pre><code>const [, segment1, segment2] = &quot;name/lastname&quot;.match(/([^/]+)\/(.*)/);
  console.log(segment1, segment2)
  </code></pre>
  <p>how can I check if is iterable? or check if segment1 and segment2 both are not null/undefined?</p>