构造函数传递一个值也可以创建数组

2017-06-15 18:32:00
admin
原创
511
<!DOCTYPE html>
<html>
<head>
    <title>Array Type Example</title>
    <script type="text/javascript">
        
        var colors = new Array(3);      //create an array with three items
        var names = new Array("Greg");  //create an array with one item, the string "Greg"

        alert(colors.length);
        alert(names.length);

    </script>
</head>
<body>

</body>
</html>
  • QQ讨论群
  • 关注微信
    • 欢迎咨询
    • 欢迎加入QQ群 16506021
  • 公众号:源宝网络