首页 > 代码库 > javascript and dom1
javascript and dom1
<script type="text/javascript"> //数组 var beatles=Array(4); var beatles=Array(); console.log(beatles);//[] beatles[0]="John"; beatles[1]="Paul"; beatles[2]="George"; beatles[3]="Ringo"; console.log(beatles[3]);//Ringo var beatles=Array("John","Paul","George","Ringo"); console.log(beatles.length);//4 var beatles=["John","Paul","George","Ringo","Liuwei"]; console.log(beatles[4]);//Liuwei var lennon=["John",1940,1943]; console.log(lennon.length);//3 var name="John"; beatles[0]=name; console.log(beatles[0]);//John var names=["Ringo","John","George","Paul"]; beatles[1]=names[2]; console.log(beatles[1]);//George var lennon=["Ringo",1940,false]; var beatles=[]; beatles[0]=lennon; console.log(beatles[0]);//["Ringo",1940,false] var lennon=Array(); lennon["name"]="John";//不建议用这种关联数组 lennon["year"]=1943; lennon["living"]=false; console.log(lennon);//[] //living false //name "John" //year 1943 </script>
javascript and dom1
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。