title: In JS, console.log behaves in different ways as shown in code. Why?
body: <p>In the code below, <code>console.log(obj)</code> and <code>console.log(&quot;obj&quot;+&quot;\n&quot;+obj)</code> behaves in two different way in output.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const obj = new Object()
  obj.firstName = 'Jack'
  obj.lastName = 'Reacher'
  obj.isTrue = true
  obj.greet = function(){
    console.log('hi')
  }
  
  console.log(obj)//getting all the members
  
  
  console.log("obj"+"\n"+obj)// not getting any member</code></pre>
  </div>
  </div>
  </p>