Javascript, why doesn't it work?
-
var data = "{ posX: 384, posY: 128 }"; endPos = JSON.parse(data); console.log(endPos.posX); console.log(endPos.posY);
It doesn't work.
-
Incorrect rubber.
JSON.parse()
has strict entry rules. With that line, it's going to be great.var data = '{"posX": 384, "posY": 128}';