rse / es6-features

ECMAScript 6: Feature Overview & Comparison

Home Page: https://rse.github.io/es6-features/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extended Literals - confusing output from example

romanet opened this issue · comments

I understand it is written in purpose to show ES6 feature in a clear way (and it does). When I read the overview, I am trying to run the examples in the browser console and the output of "\u{20BB7}" === "𠮷" === "\uD842\uDFB7" is false. My first thought was that the browser doesn't support it yet.
I am okey when partial example give an error and I need to add some code to it, or the example with for (let codepoint of "𠮷") console.log(codepoint) gives Uncaught SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode error, and I need add

(function(){ 
  "use strict";
  for (let codepoint of "𠮷") console.dir(codepoint);
})()

but if the example is valid Javascript, I think, it should give unabigouse output.

Current example

"\u{20BB7}" === "𠮷" === "\uD842\uDFB7"

output => false

Suggested

("\u{20BB7}" === "𠮷") && ("𠮷" === "\uD842\uDFB7")

or

"\u{20BB7}" === "𠮷" && "𠮷" === "\uD842\uDFB7"

or

"\u{20BB7}" === "𠮷"
"𠮷" === "\uD842\uDFB7"

Now fixed. Thanks for the hint.