本文共 278 字,大约阅读时间需要 1 分钟。
let a = '["a","b","c"]';// √let b = "['a','b','c']";// X// 对象let a1 = '{"name":"听风是风","age":"26"}';// √let b1 = "{'name':'听风是风','age':'26'}";// Xconsole.log(JSON.parse(a))// Arrayconsole.log(JSON.parse(a1))// Objectconsole.log(JSON.parse(b))// 报错console.log(JSON.parse(b1))// 报错
转载地址:http://rnjq.baihongyu.com/