Michio JP

Michio JP


ECMAScript 2019 and beyond

ECMAScript 2019, the planned next version of the specification serving as the basis of JavaScript, is moving forward. A number of proposals have reached the “finished” stage thus far.

Last month - June 2019 - 10th edition of ECMA-262 standard was officially published. What does it mean? - Well, ECMAScript 2019 is here! The latest and greatest specification for JavaScript and other derivatives languages to follow. And while you may already have heard of some of its new features, we’ll recall all of them! Plus some ECMAScript details and a sneak-peak of what’s coming next!

Release cycle

While we already know what ECMAScript is, and how it’s now-yearly release cycle works, there are some more interesting things to it.

Surely the release of every new ES specification is important, but it’s recommended not to look at it as a once-per-year thing (unless you’re living in pre-ES6 era). The specification is “alive”, being worked on as you’re reading this. Every release is just a summary of a bunch of new features. And that’s how you should look at it - feature by feature.

You might know by now (possibly due to working with Babel before) that ECMAScript specification is created as a result of different proposals. Each proposal needs to go through 5 different stages…

Every new proposal starts its life as merely an idea, which needs to first be reviewed by TC39. This committee consists of experts and representatives of different companies/organizations (like Google and Mozilla) and decides about the future of the specification. When the submitted idea is positively reviewed, it goes to stage-0. From now on, it’s public and available from the corresponding GitHub repo. As the proposal is discussed further and further at regular TC39 meetings, it either gets to the next stage or is abandoned in the process. Proposals at stage-3 can be considered to be very stable and assured. After the proposal reaches stage-4*,* it’s official.

Now, all this process - different stages and stuff - doesn’t necessarily match the implementation time. Many browser vendors in order to keep their browser ever-green and appealing to developers, often implement features even when they’re still at the stage-3. Naturally, as such features are still non-standard, many people will most likely either use Babel or won’t use the feature at all! But still, it’s a fact. With that said, some features may even be implemented a while after the official specification drops. But, since the last “big” release of ES (ES6), such things don’t take place very often.

ECMAScript 2019

With ES release cycle out of the picture, let’s explore all new features of ES2019! I know that you might already have seen these before, but, please, let’s bear with me for a moment as we’re going to do this once more, in a beginner-friendly manner!


As I mentioned earlier, many of ES2019 features can appear in browsers before the official specification drops. That’s the case with two new immutable array methods - <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat" target="_blank">.flat()</a> and <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap" target="_blank">.flatMap()</a>.

Now, I’ve covered these methods a while back, so check that out if you want to learn more. Here’s a little refresher!

const keys = ["a", "b", "c", "d"];
let values = [1, [2, [3, 4]]];

values = values.flat(2); // [1, 2, 3, 4]

values.map((value, index) => {
  return [keys[index], value];
}); // [["a", 1], ["b", 2], ["c", 3], ["d", 4]]

values.flatMap((value, index) => {
  return [keys[index], value]
}); // ["a", 1, "b", 2, "c", 3, "d", 4]

I think the naming of these methods reveal all there is to them. .flat() can be used to flattenyour multi-dimensional array. By default, it does it 1 level deep, but you can optionally pass an argument to specify the deepness, as we did in the example above.

Because calling .flat() in combination with <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" target="_blank">.map()</a> can be very useful, there’s a special method for that too! - .flatMap(). This guy maps the array first and then flattens it 1 level deep (no configuration here). And all of that comes with the improved performance of course!


With the introduction of <a href="https://areknawo.com/rocking-js-data-structures/" target="_blank">Map</a> objects in ES6 and the need of representing the data with arrays in key-value fashion, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries" target="_blank">Object.fromEntries()</a> can prove to be quite useful when doing such operations. It can change your Array or Map of key-value pairs (entries) into an actual object - something that before ES2019 required custom code.

const arr = [
    ["key1", "value1"],
    ["key2", 2],
    ["key3", {value: 3}]

// { key1: "value1", key2: 2, key3: { value: 3 } }

String.prototype.trimStart() and more…

ES5 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim" target="_blank">.trim()</a> method has 2 new colleges, or even 4! While .trim() was removing unnecessary spaces from both sides of the string, now there’re some new methods to do that form only the specified one!

<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimStart" target="_blank">.trimStart()</a>, also known as .trimLeft(), can be used to trim the string from its start/left side…

const str = "     str     ";

str.trimStart(); // "str     "
str.trimLeft(); // "str     "

while <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimEnd" target="_blank">.trimEnd()</a> and .trimRight() can be used to do the same, from the right side.

const str = "     str     ";

str.trimEnd(); // "     str"
str.trimRight(); // "     str"

Optional catch binding

Apart from bringing us only a few new methods, ES2019 fixes some flaws of its predecessors. First one being the requirement to include error parameter in try/catch statements, even when not using it.

// then
try {
    // ...
} catch(error) {
    // ...

// now
try {
    // ...
} catch {
    // ...

The less code to write the better, right?


In ES-based languages, you can .toString() pretty much all the things! What its different calls will resolve in is a whole another story. But, up to ES2019, when used with functions, <a href="https://developer.mozilla.org/pl/docs/Web/JavaScript/Referencje/Obiekty/Function/toString" target="_blank">.toString()</a>returned a string with the function’s code only. Now, it also takes into account comments, new lines, and whitespaces - everything!

function toBeStringified() {
    // a comment
    // a comment after new line

`function toBeStringified() {
    // a comment
    // a comment after new line


<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol" target="_blank">Symbol</a> - always-unique data type used mostly as object’s properties identifier - just got a new property called .description. It can be used to access the Symbol’s optionally-passed description parameter, in the form of a string.

const mySymbol = Symbol(2);

mySymbol.toString(); // "Symbol(2)"
mySymbol.description; // "2"


If you’ve used <a href="https://developer.mozilla.org/pl/docs/Web/JavaScript/Referencje/Obiekty/Array/sort" target="_blank">.sort()</a> before, you might know that it’s a recommended practice not to rely on its default sorting algorithm. That’s because there was no mention of any stability requirements for the algorithm, in the previous specifications. Now, in ES2019, that “stable sort” is required by specs, every JS engine needs to comply with it. That means that they still can use different algorithms, but there shouldn’t be any misconceptions related to that. To see what I mean - check out the example below.

const dogs = [
  { name: "Abby",   rating: 12 },
  { name: "Bandit", rating: 13 },
  { name: "Choco",  rating: 14 },
  { name: "Daisy",  rating: 12 },
  { name: "Elmo",   rating: 12 },
  { name: "Falco",  rating: 13 },
  { name: "Ghost",  rating: 14 },

// Sort the dogs by `rating` in descending order.
dogs.sort((a, b) => b.rating - a.rating);
  { name: "Choco",  rating: 14 },
  { name: "Ghost",  rating: 14 },
  { name: "Bandit", rating: 13 },
  { name: "Falco",  rating: 13 },
  { name: "Abby",   rating: 12 },
  { name: "Daisy",  rating: 12 },
  { name: "Elmo",   rating: 12 },

As you can see in the result comment above, the array is sorted “as expected” by our sorting function. In the original one - the items were sorted alphabetically by the name field. Now, they’re sorted by rating first, but they’re still in alphabetical order. The second fact is kind-of expected (sorted items should respect their previous positions), but it wasn’t guaranteed before ES2019. From now on, new browsers will assure you the right order. But know that the old ones are still out there. That’s why you should be very explicit when writing your sorting functions and not necessarily depend on the browser’s default behavior too much.

A word on JSON…

JSON and JSON-related functionalities got a little revision too!

JSON.stringify() now properly escapes Unicode [“lone surrogates”](https://unicode-table.com/en/blocks/high-surrogates/“lone surrogates””). This isn’t such a big deal, considering that you might hardly ever encounter issues related to that. Still, it’s one thing to think about less when writing your code. To give you an example:

// then
JSON.stringify('\uD800'); // "'�'"

// now
JSON.stringify('\uD800'); // "'\\ud800'"

There’s yet another issue with Unicode strings that was fixed with ES2019! JSON is usually considered a subset of ECMAScript, but it wasn’t entirely true up until this point. JSON strings could contain some unescaped Unicode characters (U+2028 and U+2029), while ES strings could not. Now, ES supports these characters, the issue is fixed, and JSON is truly a subset of ES.

What the future holds?

Now that we’ve covered all of the ES2019 goodness - what’s next? New features are constantly being introduced to modern browsers engines (like V8), even when they’re only at stage-3! Some of them are already scheduled for ES2020, others - not so much. But, I’d like to give you a small glimpse of the future which, in some cases, can be experienced right now! With that said, here’s 3 most interesting features to look forward to in ES2020 and beyond!

Dynamic import()

From what I know, many developers still use code bundlers, even with ES modules being officially supported by all major browsers. But who can blame them? Modules really need some more “standardization” - not from the specification, but from the community. And for that, some time needs to pass and old browsers have to die…

But, so-called dynamic import() is definitely going to part of this “modular future”. Well… maybe future is a bit too bold of a term, considering that this feature has already been implemented by all major browsers and is at stage-4, scheduled for ES2020.

    .then((module) => {
      module.default(); // export default stuff
      module.doStuff(); // other stuff

The main advantage of dynamic import() is the fact that loading modules is done in a lazy manner. In this way, you can significantly improve your app’s performance, just by loading the necessary stuff first (with standard import statements), and everything other later. Plus, they’re almost unnoticeable in syntax when done with async/await!

(async () => {
    const module = await import("module.mjs")


Dealing with large numbers in JS can be pretty problematic. The range of possible values is big, but, in some cases, it’s just not enough. And that’s why <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt" target="_blank">BigInt</a> was born!

BigInt is a completely new numeric primitive that works alongside currently-available Number. It’s already implemented in Chromium-based and some other browsers, but that’s pretty much it. The support will definitely grow once BigInt gets beyond stage-3 and becomes official seemingly with ES2020.

For now, until the support gets better, I think all you need to know is that you’ll be able to express some big numbers in JS with great performance, without any 3rd-party library!

BigInt(Number.MAX_SAFE_INTEGER) + 2n; // 9007199254740993n
/* Value bigger than Number can represent
   BigInts can be created with -n suffix */

Of course, as the name implies, BigInt can only be used to represent integers. This makes me really look forward to possible BigDecimal (or something like that) in the future…

Private class fields

Probably one of the most awaited features of ES. Private class fields are something that many developers really want. The ability to hide the implementation details for real!

Private class fields are currently at stage-3. It’s yet unsure if we’ll see them in ES2020 or not. But, despite how awesome of a feature this might be, I still have some concerns about it. First, by current proposal, there’s no mention of any kind of protected fields - those who use TypeScript or some other statically-typed language know what I’m talking about. And, what’s even worst - the syntax for private fields in ES proposal is just… bad IMHO. The cross-language untold “standard” of public, protected and private keywords is replaced by a hash (#) symbol. Even though, I’m still happy that such feature (in any shape or form) is coming to JS!

class IncreasingCounter {
    #count = 0;
    get value() {
        console.log("Getting the current value!");
        return this.#count;
    increment() {

Want to know more?

ES specification and proposals are evolving every day. So do browsers and JS engines. If you want to be up-to-date with the latest and greatest features, I encourage you to check out v8.dev blog, where people behind V8 share very insightful information about the engine, its latest features and how they were implemented. Highly recommended!

#javascript #web-development #typescript

What is GEEK

Buddha Community

ECMAScript 2019 and beyond
Sagar Shende

Sagar Shende


12 Best Mobile Games 2019 in the World

2019 is the Best Year for Games If You’re Finding for the Best mobile games 2019 in the Google Play Store, then You can find the Best Game From this list. We try to update this list as soon as possible as New Games released that Worth of Being added in this List.

So Without wasting any time. Let’s Start in and Discover Lots New and Amazing Fun Games.

Best Mobile Games 2019

Read More

#best mobile games 2019 #mobile games 2019 #best mobile games 2019 in the world

Ethan Hughes

Ethan Hughes


JavaScript: Guide to New ECMAScript 2020 Features

ECMAScript is the specification upon which JavaScript is based. And since 2015, it has been evolving year after year, with the addition of features like classes, modules, async/await and many others. And what makes things even better is that today’s browsers add support for new features quickly, with a short time between releases. In this article, you’ll find out what is new in ECMAScript 2020. Have a good read!

#javascript #ecmascript #ecmascript-2020

Luna  Hermann

Luna Hermann


Introduction to “reflect-metadata” package and its ECMAScript proposal

Metadata, in a nutshell, is extra information about the actual data. For example, if a variable represents an array, the length of that array is metadata. Similarly, each element in that array is data but the data-type of these elements is metadata. Loosely speaking, metadata is not the actual concern of a program, but it can help us achieve things quicker.

Let’s take a small example. If you need to design a function that prints information about other functions, what information would you print?

Image for post


In the above example, the funcInfo function takes a function as an argument and returns a string that contains function name and the number of arguments this function accepts. This information is contained in the function itself, however, we almost never use that in practice. Therefore, func.name and func.length can be considered as metadata.

#nodejs #ecmascript-6 #javascript #ecmascript #es6

Joshua Rowe

Joshua Rowe


Meet BigInt, New Features of ECMAScript 2020 - The Future and Beyond

BigInt is a native JavaScript object that provides a model of representation of integers larger than, which is the largest number that JavaScript can accurately represent, using the primitive type Number. ECMAScript 2020 - The Future and Beyond.


BigInt’s syntax is:



value: is the numeric value of the object that will be created. This can be a string or an integer.

It is important to note that BigInt() is not used with the new operator.

BigInt is created by simply adding an “n” to the end of a literal integer - 10n - or by calling function BigInt();

const theBiggestInt = 9007199254740991n;
const alsoHuge = BigInt(9007199254740991);
// 9007199254740991n
const hugeString = BigInt("9007199254740991");
// 9007199254740991n
const hugeHex = BigInt("0x1fffffffffffff");
// 9007199254740991n
const hugeBin = BigInt("0b11111111111111111111111111111111111111111111111111111");
// 9007199254740991n

BigInt differs from Number in some important matters. For example:

  • It cannot be used with methods on the Math object;
  • It cannot be mixed into operations or any Number instance. They must be handled with the same type.
  • BigInt’s accuracy can be lost by converting values to Number.

If you want to run some tests, you can:

  • Testing with typeof:
typeof 1n === 'bigint'; // true
typeof BigInt('1') === 'bigint'; // true
  • If it is involved in an Object, BigInt will be considered as a normal type of “object”:
typeof Object(1n) === 'object'; // true

You can also perform operations with BigInt or with BigInt involved in an object:

const antigoMaximoInt = BigInt(Number.MAX_SAFE_INTEGER);
// 9007199254740991
const maximoMaisUm = antigoMaximoInt + 1n;
// 9007199254740992n
const oFuturo= antigoMaximoInt + 2n;
// 9007199254740993n, isso funciona agora!
const multiplicando = antigoMaximoInt * 2n;
// 18014398509481982n
const subtraindo = multiplicando – 10n;
// 18014398509481972n
const modulo = multiplicando % 10n;
// 2n
const bigN = 2n ** 54n;
// 18014398509481984n
bigN * -1n
// –18014398509481984n


The/operator also works. However, if the numbers are BigIntS and not BigDecimalS, the operation will be rounded to zero, which will not bring us any fractional value.

const divisao = 4n / 2n;
// 2n
const arredondado = 5n / 2n;
// 2n, e não 2.5n

It is important to note that BigInt is not strictly the same as a Number, but they can be compared normally.

0n === 0;
// false
0n == 0;
// true
1n < 2;
// true
2n > 1;
// true
2 > 2;
// false
2n > 2;
// false
2n >= 2;
// true

BigInt behaves like a number when it is converted to a Boolean, and can also be used with logical operators, also within a conditional structure.

if (0n) {
    console.log("Olá, você está dentro do IF");
} else {
    console.log("Olá, você está dentro do ELSE");
0n || 12n;
// 12n
0n && 12n;
// 0n
//  false
// true



Allows the addition of properties to a BigInt object. All BigInt instances are inherited from BigInt.prototype. The prototype object of the BigInt constructor can be modified to affect all instances of BigInt.

#ecmascript #bigint #javascript #ecmascript2020

Unpatched Wi-Fi Extender Opens Home Networks to Remote Control

The Homeplug device, from Tenda, suffers from web server bugs as well as a DoS flaw.

A popular Wi-Fi extender for the home has multiple unpatched vulnerabilities, including the use of a weak, default password, according to researchers. Also, two of the bugs could allow complete remote control of the device.

The flaws have been found in Tenda PA6 Wi-Fi Powerline extender, version, which extends the wireless network throughout the house using HomePlug AV2 technology.

“A compromised device can become part of an internet of things (IoT) botnet that launches distributed denial-of-service (DDoS) attacks, used to pivot to other connected devices, leveraged to mine for cryptocurrency or used in various other unauthorized ways,” explained researchers at IBM X-Force, in a posting last week.

Web Server Woes

The first two bugs are a command-injection issue (CVE-2019-16213); and a critical buffer overflow (CVE-2019-19505). They are found in the extender device’s web server, under a process named “httpd.”

The command-injection vulnerability carries a rating of 8.8 out of 10 on the CVSS severity scale. It arises from the fact that under the “Powerline” section in the user interface (UI) of the extender’s web server, the user can see and change the name of the other powerline communication (PLC) devices which are attached to the same powerline network. An authenticated user can inject an arbitrary command just by changing the device name of an attached PLC adapter with a specially crafted string, the researchers noted. Since the web server is running with root privileges, an attacker could leverage this injection to fully compromise the device.

“The name entered by the user is concatenated as an argument to the ‘homeplugctl’ application and being executed by the system’ library function,” according to IBM X-Force. “This user input is just URL decoded, without any validation or sanitation.”

The second vulnerability is found in the “Wireless” section in the web-UI: By adding a device to the Wireless Access Control list with a specially crafted hostname, a remote attacker could overflow a buffer and execute arbitrary code on the system or cause the application to crash. It’s listed as critical, with a 9.8 severity rating.

“It is possible to overwrite the return address register $ra and begin controlling program execution,” according to the analysis. “A motivated attacker can utilize this to potentially execute arbitrary code. Note that the overflow isn’t a result of an unsafe call to functions like strcpy or memcpy.”

#iot #vulnerabilities #web security #buffer overflow #code execution #cve-2019-16213 #cve-2019-19505 #cve-2019-19506 #denial of service #homeplug #internet of things #pa6 wi-fi powerline extender #remote control #security vulnerabilities #tenda #unpatched #version #wi-fi extender