js中有["1","2","3","4"]这样一个string,怎么把它变成array
["1","2","3","4"]这是从后台通过JSONArray返回的用split分的话很麻烦...
["1","2","3","4"]这是从后台通过JSONArray返回的
用split分的话很麻烦 展开
用split分的话很麻烦 展开
3个回答
展开全部
<script>
var temp = '["1","2","3","4"]';
var ary = eval('(' + temp + ')');
for (var i = 0 ;i<ary.length;i++){
alert(ary[i]);
}
</script>
var temp = '["1","2","3","4"]';
var ary = eval('(' + temp + ')');
for (var i = 0 ;i<ary.length;i++){
alert(ary[i]);
}
</script>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
都把它SET进去!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询