[x3d-public] impact for JSON: ES6 and duplicate object literal properties
yottzumm at gmail.com
yottzumm at gmail.com
Mon Dec 19 09:58:24 PST 2016
On Dec 19, 2016 12:03 PM, "Don Brutzman" <brutzman at nps.edu> wrote:
Hmmm, maybe OK? Here are some tests.
Maybe. I'd like to put "use strict"; in front of it and run it through some browsers but I've been giving my hands a break.
Codepen.io reports an error in chrome.
On 12/18/2016 6:01 AM, yottzumm at gmail.com wrote:
Note that in ES6, even in strict mode, the following will not cause an error:
var books = {
title: “Understanding ECMAScript 6”,
title: “JavaScript: The Good, the Bad and the Ugly”
};
However,
books.title === “JavaScript: The Good, the Bad and the Ugly”
Might you know the ES6 specification paragraph?
http://www.ecma-international.org/ecma-262/6.0/#sec-terms-and-definitions-object
There are two mentions of “object literal” in standard and they appear unrelated. It’s mentioned under “Duplicate Object Literal Properties” on page 75 of Understanding ECMAScript 6:
“But in ECMAScript 6, the duplicate property check was removed. Strict and non-strict mode code no longer check for duplicate properties.”
I think maybe it’s just that the JSON parsers don’t catch it.
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20161219/e316638a/attachment.html>
More information about the x3d-public
mailing list