title: Does console.log invokes toString method of an object?
body: <p>As per this <a href="https://developer.mozilla.org/en-US/docs/Web/API/Console/log#Parameters" rel="noreferrer">documentation</a>,</p>
  
  <blockquote>
    <p>The string representations of each of these objects are appended
    together in the order listed and output.</p>
  </blockquote>
  
  <p>Also as per <a href="https://stackoverflow.com/a/14597279/1984039">answer</a></p>
  
  <blockquote>
    <p>The + x coerces the object x into a string, which is just [object
    Object]:</p>
  </blockquote>
  
  <p>So, my question is</p>
  
  <p>If I do</p>
  
  <pre><code>str = new String("hello")
  console.log(str) //prints the string object but not 'hello'
  console.log(""+str) //prints "hello"
  </code></pre>
  
  <p>So, in first case, it simply prints the object (doesn't invoke the <code>toString()</code> method).</p>
  
  <p>But in second case, it doesn't coerce but simply print the primitive value. Why is that so?</p>
  
  <p>Which method does <code>console.log</code> invokes to print the object?</p>
  
  <p>Please note that - this is not a duplicate of this <a href="https://stackoverflow.com/questions/13244308/in-javascript-does-console-log-on-an-object-call-tostring">question</a>.</p>