JSON.parse()的作用

 console.log("flightVideoing", typeof [[${flightVideo}]])
 var flightVideo = JSON.parse([[${flightVideo}]]);
 console.log("flightVideoed", typeof flightVideo)

结果:

flightVideoing string
flightVideoed object

作用就是将json字符串转为js里面的对象,用来转换类型

相反流程使用JSON.stringify(flightVideo)

猜你喜欢

转载自blog.csdn.net/qq_36939013/article/details/93333555