title: How to check if object or var is traversable in Javascript?
body: <p>How can I check the object or variable is traversable in Javascript or jQuery?</p>
  
  <p>An object or a variable which is traversable must works in <strong>for each</strong> like <code>object.forEach()</code> and <code>$.each(object, callback)</code> in jQuery.</p>
  
  <p>Actually I want to validate it then use it in for each loops.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>The solution which I looking for is something like this:</p>
  
  <pre><code>if(is_traversable($var)) {
      $var.forEach(function(value, key) {
          console.log(value);
      }
  }
  </code></pre>
  
  <p>And you may give me an implementation of <code>is_traversable()</code> function.</p>