Home > front end >  Why the output is the object on the page
Why the output is the object on the page

Time:10-31



<meta charset="utf-8"/& gt;
The constructor calls & lt;/title> <br/></head> <br/><body> <br/><The script type="text/javascript" & gt; <br/>Complete the task//in this <br/>The function Person (name, age) {<br/>This. Name=name; <br/>Enclosing the age=age; <br/>}; <br/>Var obj=new Person (' xm, 18); <br/>Document. The write (obj); <br/><br/>The function Array (num1, num2) {<br/>Enclosing num1=num1; <br/>Enclosing num2=num2; <br/>}; <br/>Var arr=new Array (' 3 ', '5'); <br/>Document. The write (new Array ()); <br/></script> <br/></body> <br/></html> <br/><p class="article - content rp"> CodePudding user response: </p>Sweat, this is all the object, the output must be object, suggestion about basic data types and complex data types<p class="article - content rp"> CodePudding user response: </p>Instantiation of the object. Attribute is you have to the value of the <br/><br/>Ps <br/><br/>Obj. Name <br/>Obj. Age<p class="article - content rp"> CodePudding user response: </p>Want to print in detail, using similar to: the console log (JSON. Stringify (obj, null, 2)) <br/>Or you print like that, is [object XXXX] </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/frontend/75073.html" target="_blank" style="color:#999">https//www.codepudding.com/frontend/75073.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/frontend/75072.html'>How ajax request parameters with type a json string with another string? How do you write the format</a></div> <div class="detail-arr-right">Next:<a href='/frontend/75074.html'>Give a person (the person) by method (setPerson) to add attributes (name: 'xm, age: 18, sex:�</a></div> </div> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="hot-tags neitags"> <ul> <li><i class="iconfont icon-x-tags"></i> Tags:  </li> <a href='/e/tags/?tagname=JavaScript' target='_blank'>JavaScript</a> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="xiangguan"> <ul class="msg msghead"> <li class="tbname">Related</li> </ul> <ul> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="flinks"> <ul> <li><i class="iconfont icon-x-tags"></i> Links:  </li> <li class="liflinks"><a target="_blank" href="/" title="CodePudding">CodePudding</a></li> </ul> </div> </div> </div> </div> <div class="footer"> <p><span style="font-size:16px;color:#666;font-weight: bold">About Us:</span>  <a href="https://www.codepudding.com/contact.html">Contact Us</a>      <a href="https://www.codepudding.com/service.html">Terms of Service</a>      <a href="https://www.codepudding.com/privacy.html"> Privacy Policy</a></p> <p class="foot_info">Copyright © 2010-2023,Powered By <a href="/" target="_blank">CodePudding</a> </p> </div> <script type="text/javascript" src="/skin/code/tianhu.js"></script> </body></html>