您的位置:首页 > Web前端 > JavaScript

js 常用写法笔记

2016-11-26 21:02 232 查看

数据结构

js 数组及字典

var dic = new Array();      //注意它的类型是Array
dic["url"] = "images/gallery_128px_dark.png";
dic["reserved"] = "";
var dic2 = new Array();      //注意它的类型是Array
dic2["url"] = "images/gallery_128px_yellow.png";
dic2["reserved"] = "";
var dic3 = new Array();      //注意它的类型是Array
dic3["url"] = "images/gallery_128px_dark.png";
dic3["reserved"] = "";
$scope.dicList=[];
$scope.dicList.push(dic);
$scope.dicList.push(dic2);
$scope.dicList.push(dic3);

console.log($scope.dicList);

数组初始化:

this.row=new Array("","","","") ;

二维数组初始化:

this.row=new Array("","","","") ;
this.colume=[];
this.colume.push(this.row);
this.colume.push(this.row);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: