Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ES2019/ES10 - JavaScript in 2019

Marko Arsić
September 20, 2019

ES2019/ES10 - JavaScript in 2019

More amazing changes in our beloved ECMAScript, a.k.a. Javascript. The TC39 (Technical Committee) just released the 10th edition of the specification.

Demo snippets: https://gist.github.com/marsicdev/31216f173e724e45c53e3bc3e0a7135b

Talk given at Armada JS Conference

Marko Arsić

September 20, 2019
Tweet

More Decks by Marko Arsić

Other Decks in Programming

Transcript

  1. Actively engaged in developing software solutions for the last 9

    years using Java, Kotlin, Objective C / Swift and JavaScript programming languages Marko Arsić Senior software developer Independent Tech Consultant Lecturer [email protected] @mArsic In the local community primarily known as a regular speaker at community meetups, and also as a program coordinator and lecturer at Belgrade Institute of Technology React and React Native software packages are currently my focus https://hypetech.xyz
  2. More amazing changes in our beloved ECMAScript, a.k.a. Javascript. The

    TC39 (Technical Committee) just released the 10th edition of the specification ES2019 / ES10
  3. Stage 1 (Proposal) More fleshed out and has an API.

    Has a “champion(s)” who wants to move it forward.
  4. It was also beneficial to give them names that more

    aligned with their purpose Removing starting space and ending space
  5. Allowed objects to make use of the numerous functions built

    into the Array prototype like map, filter, reduce, etc It required a somewhat manual process to turn that result back into an object
  6. Object.fromEntries gives you much more concise code that invites you

    to make use of array prototype methods on objects
  7. It is important to note that arrays and objects are

    different data structures for a reason There are certain cases in which switching between the two will cause data loss
  8. Multi-dimensional arrays are a pretty common data structure The ability

    to flatten it is necessary and it was always possible, but not exactly pretty
  9. If no argument is given, the default depth is one

    Function is not greedy by default and requires explicit instructions to operate
  10. What about a situation where we want to insert elements

    into an array. Relatively popular pattern, especially in functional programming.
  11. flatMap is the equivalent of combing map and flat with

    no argument flatMap will only flatten one level
  12. Promise.allSettled method takes an array of promises and resolves once

    all of the promises have either resolved or rejected
  13. The then callback receives the status and value of each

    promise in the order of their appearance.
  14. Promise.any (stage 2) method is similar to Promise.race but the

    promise returned by this method does not execute the catch block as soon as any of the promises gets rejected
  15. If none of the promises is resolved, catch block will

    get executed If any of the promises have resolved first, then block will be executed
  16. Allow developers to use try/catch without creating an unused binding

    You are free to go ahead make use of catch block without a param
  17. Great option if you already know what the error is

    and are looking for what data triggered it
  18. this keyword doesn’t have a definite value The value this

    depends on the context where it was accessed
  19. The global value of this inside Node.js points to the

    global object and inside a web worker it points to the web worker itself. It’s tricky to get global this value as we can’t use this keyword everywhere
  20. JavaScript doesn’t have property modifiers like public, private and protected

    All properties on an object are public by default, which means anybody can access them
  21. With the private class fields, we can make class properties

    only accessible inside the class only and prevent them from reflecting on the instance (object)
  22. A private class field can be defined in the same

    way a public class field but with # prefix. Accessing private property on an object will result in SyntaxError: Undefined private field
  23. class Dog { // this is private #sound = 'Woof!

    Woof!' makeSound() { console.log(this.#sound) } }
  24. • Numeric Separators • Well Formed JSON.stringify() • Array.prototype.sort -

    Stability • Function.prototype.toString - Revision • RegExp Lookbehind