其他分享
首页 > 其他分享> > Js键值对类型

Js键值对类型

作者:互联网

声明:

var points= {};

 

存:

points.a='123'; 
points.b ='456';
var p1 = 'c';
points[p1]='789';

结果points= {'a':'123','b':'456','c':'789'};

 

 

取:

var d = points['a']; 
//则d的值就是‘123’

 

删除:

delete(points['a']);

 

循环取值:

for(var i in points)
{
    alert(points[i]);
}

 

标签:p1,789,456,Js,var,123,键值,类型,points
来源: https://www.cnblogs.com/judes/p/15909020.html