JavaScript in没有给出string的属性值

时间:2017-02-14 05:02:19

标签: javascript

    <html>
       <body>

          <script type="text/javascript">
                var aProperty;
                document.write("Navigator Object Properties<br /> ");
                for (aProperty in navigator) {//working fine
                   document.write(aProperty);
                   document.write("<br />");
                }
                var x= new String();
                for (aProperty in x) {//not printing
                   document.write(aProperty);
                   document.write("<br />");
                }

          </script>

          <p>Set the variable to different object and then try...</p>
       </body>
    </html>

这里使用navigator对象的关键字是在控制台上提供所有属性和打印,但为什么它不能使用字符串对象

0 个答案:

没有答案