2 ms·
Perhaps, but probably not. ES6 recognises the distinction, and includes native functions for serialisation. That's first-class treatment if anything is.
by wyattpeak 8y ago
Perhaps, but probably not. ES6 recognises the distinction, and includes native functions for serialisation. That's first-class treatment if anything is.
- Scarblac 8y agoJSON.stringify and JSON.parse? They're standard library functions that many languages have, I don't see what's ES6 about them, they're much older. First class treatment would be if the language had JSON-typed objects with functionality, e.g. something like const myJson = j'{"key":"value"}'; const value = myJson['key']; const newJson = myJson.set("otherkey", "newValue"); (using the j'' notation for a hypothetical json-typed value) But AFAIK it doesn't, not even in ES6.
- brlewis 8y agohttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... Implementing j`{"key":"value"}`; as a tagged template literal is left as an exercise for the reader.