nzakas / understandinges6

Content for the ebook "Understanding ECMAScript 6"
5.45k stars 796 forks source link

Error in Appendix A - Smaller Changes - Unicode code point escapes #457

Open ronen-e opened 3 years ago

ronen-e commented 3 years ago

Where: Line 91 in Appendix A - Other changes

// Valid in ECMAScript 5 and 6
var \u{61} = "abc";

console.log(\u{61});      // "abc"

// equivalent to:
 console.log(a);          // "abc"

Reason: the text "Valid in ECMAScript 5 and 6" is incorrect Code point escapes were added to JavaScript in ECMAScript 2015 (ES6). The example is not valid for ES5

Suggested Fix:

// Valid in ECMAScript 6
var \u{61} = "abc";

console.log(\u{61});      // "abc"

// equivalent to:
 console.log(a);          // "abc"