search

Home  >  Q&A  >  body text

javascript - console.log() method output problem

var op=document.querySelector('p');
        var oP=document.createElement('p');
        console.log(oP);
        oP.innerHTML='hello';
        op.append(oP);

Why is the output here not <p></p>, but <p>hello</p>?

天蓬老师天蓬老师2869 days ago715

reply all(2)I'll reply

  • 某草草

    某草草2017-05-16 13:47:20

    This is outputting your nodes. Doesn’t the node include content?

    reply
    0
  • 为情所困

    为情所困2017-05-16 13:47:20

    This is the behavior of the browser to save computing resources. If the console is not opened during debugging, console.log will print the processed objects. If you open the console to view the output, console.log will print real-time Object.

    reply
    0
  • Cancelreply