Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
20 views

Undestanding Modern JavaScript

Uploaded by

mrfix
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
20 views

Undestanding Modern JavaScript

Uploaded by

mrfix
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 9
a davidlwebdev » © JavaScript ) Understanding MODERN JAVASORIPT . / . ot What is ECMAScript? ) ECMAScriptis a scripting language specification and it determines how JavaScript works and what new features it should have. Features are usually released incrementally each year to ensure smooth updates to the JavaScript programming language. The most notable release of the ES standard was done in the year 2015, with the release of ES6, which brought a lot of the amazing JavaScript features we use today in modern code. This post will help you explore and understand the shifts in the JavaScript programming language throughout the years, showcasing key features that have been part of past releases. Let’s get started! ee ES6 (2015) ‘) The biggest year for JavaScript, this release includes some really important updates that any JS developer should know! Key Features The let & const keywords for variable declaration Template Literals | Destructuring Spread Syntax } New Array Iteration Promises | Classes & Modules oY Arrow Functions | Default Parameters This update changed JavaScript by a lot, so let’s see how it compares to the old version (ES5 - Released in 20T1) ES5 VS ES6 1. Template Literals eae steeeC oe let second = ‘webdev'; eRe) eo ae Co amass Pert see. 2. Destructuring const list = [4 ae st ae eCad Caer eee a t [one, two, ...rest] = list; console. log(one, two, rest); 3. New Array Iteration const list = [4, 5, 6]; Peres tcrr rreeo for (i of list) Corer 5 Embed expressions in strings with a cleaner syntax! Unpack values from arrays or properties from objects into distinct variables! Heavily used in React Asimpler and more declarative way to iterate over arrays. ES7 (2016) Key Features a _ Array.prototype.includes() ist list = ['bread', ‘cheese’, ‘ham']; Anew, easy way to check if an array yet) includes a certain el h ea) value Anew math operator which returns the result of the first operand raised to the power of the second operand Next ESS (2017) Key Features é Object.values() & Object.entries() const person = { name: ‘Matt’, age: 23 }; Pee CaS aee se CH eT STL Pee en @ Same CD @ ~ | Trailing Commas a cant A Trailing commas allow us to add new lines to Crt UC aaan an object without having to modify the previous line since it already has acomma Pee = | String .padStart() & padEnd() methods 4 > Asynchronous Functions (Async/Await) ES9 (2018) Key Features Asynchronous Generators & Iterators a > Object Rest & Spread Operators SFL reas st obj2 = { three: 30 } An easier way to clone, combine and work with objects in general! st clone = { Shand obj3 = { ...obj1, ...0bj2 } Promise.prototype.finally() - : RegExp Features (Named Capture Groups, dotAll) Ms ES10 (2019) Key Features Array.flat() & Array.flatMap() a > Object.fromEntries() Create objects from an array of entries! String -trimStart() & trimEnd() methods i Optional Catch Binding (Catch Block Error Param) - ESM (2020) Key Features Private Class Variables Presta Private class variables are ag console.log(2022 - this.#birthyear declared using a hash in i front of the variable or function name. Accessing const david = new Person() david. age() them outside the class console. log(david.#birthyear) will throw an error. 4 Promise.allSettled() method i » | String.prototype.matchAll() Optional Chaining Operator let car = { color: 'red' }; ae ese eee Tees Co console. interiorColor); Prevent errors in your code by using optional chaining!

You might also like