var playlist = {"bad romance":"gaga", "we cry":"the script"};
如何从我的代码中获取字符串“gaga”?你能告诉我,Javascript编程中我的数组名称是什么?
答案 0 :(得分:2)
尝试使用Object
代替Array
:
var playlist = {"bad romance":"gaga", "we cry":"the script"};
alert(playlist["bad romance"]); //gaga