JavaScript语法中将json转成数组

//将json转成数组
const positions = JSON.parse(JSON.stringify(positionsPo.value));
 positions.forEach(position => {
        const marker = new AMap.Marker({position,});
 });


获取的数据样式


positionsPo.value打印出来是
[
        [116.39, 39.9],
        [116.40, 39.91],
        [116.41, 39.92]
]
请将她转换成
const positions = [
        [116.39, 39.9],
        [116.40, 39.91],
        [116.41, 39.92]
      ];
使其正常执行

 

posted @ 2024-05-22 10:26  爱豆技术部  阅读(15)  评论(0编辑  收藏  举报
TOP