var str = 'a=""'
var res = '{"' + str.replace(/"/g, '\\"').replace(/=/g, '":"') + '"}'
console.log('res', res) // {"a":"\"\""}
// 问题1:哪个值是和res相等的?
console.log(res === '{"a":"\"\""}') // false
// 问题2:为什么是false
console.log('res1', JSON.parse(res)) // {a: """"}
问题3:JSON.parse() 的解析规则是什么?
JSON.parse(jsonData)
,jsonData是JSON格式的字符串,该方法是将JSON格式的字符串,序列化成JSON数据。