javascript - js A small algorithm question, looking for a better answer.
怪我咯
怪我咯 2017-06-30 09:57:28
0
3
550

1. String type"[[1,2],[2,4],[3,6],[1,2]]", hope to get array type[ [1,2],[2,4],[3,6],[1,2]]

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(3)
洪涛

var arr = JSON.parse("[[1,2],[2,4],[3,6],[1,2]]");

漂亮男人

Process ->

var str =  "[[1,2],[2,4],[3,6],[1,2]]";
var newStr = JSON.parse(str);
.log(newStr);

Packaging ->

function g(str){
    return JSON.parse(str);
};
刘奇

You can just search for JSON.parse. Baidu is better for this kind of problem

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!