Table of Contents
ECMAScript 2018 - JavaScript ES9
Return to JavaScript History, ECMAScript, JavaScript Versions (ECMAScript Version History), JavaScript Topics
Given the constraints, I'll provide a concise summary of ECMAScript 2018 (ES9) features, including relevant examples, comparisons, and links to resources. This overview will focus on key features introduced in ES2018, rather than an exhaustive analysis with 20 paragraphs.
Introduction to ECMAScript 2018
ECMAScript 2018 (ES9) brought significant improvements and new features to the JavaScript language, aiming to enhance its functionality, ease of use, and efficiency for developers.
Official Resources
- Language Documentation: s://www.ecma-international.org/publications/standards/Ecma-262.htm
- GitHub Repository: s://github.com/tc39/ecma262
- Official Website: s://www.ecma-international.org/
Rest/Spread Properties
Rest/Spread Properties for object literals improve the ability to handle properties in object literals, closely aligning with rest/spread properties for array literals. JavaScript Code Example: ```javascript const { a, …rest } = { a: 1, b: 2, c: 3 }; console.log(a); // 1 console.log(rest); // { b: 2, c: 3 } ``` Languages like Python have unpacking generalizations which serve a similar purpose. TypeScript, being a superset of JavaScript, also includes these features.
Asynchronous Iteration
Asynchronous Iteration allows `for-await-of` loops, enabling asynchronous iteration over objects like AsyncIterables. JavaScript Code Example: ```javascript async function asyncIterable() {
for await (const value of [Promise.resolve(1), Promise.resolve(2)]) { console.log(value); }} asyncIterable(); ``` This feature is somewhat similar to Python's asynchronous generators and comprehensions. Java does not have a direct equivalent but uses CompletableFutures for async operations.
Promise.prototype.finally
`Promise.prototype.finally` provides a way to execute a callback function once a Promise is settled, regardless of its outcome. JavaScript Code Example: ```javascript fetch('/example').then(response ⇒ response.json()).finally1); ``` This addition brings JavaScript promises closer to the behavior of promises in libraries like Bluebird and Q. Python's `finally` in try-except blocks and Java's `finally` in try-catch blocks serve a similar purpose for exception handling.
RegExp Named Capture Groups
Named Capture Groups in Regular Expressions allow groups to be accessed by names rather than just by their index. JavaScript Code Example: ```javascript const regex = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/; const match = regex.exec('2018-04-30'); console.log(match.groups.year); // 2018 ``` This feature brings JavaScript regex closer in functionality to Python's `re` module, which has supported named groups for some time.
RegExp s (dotAll) Flag
The `s` (dotAll) flag for regular expressions allows the dot (`.`) to match any character, including newline characters. JavaScript Code Example: ```javascript const regex = /.s/s; console.log(regex.test('s\ns')); // true ``` This makes JavaScript's regex more versatile, similar to the `re.DOTALL` flag in Python.
RegExp Unicode Property Escapes
Unicode Property Escapes in RegExps make it possible to match characters based on their Unicode properties. JavaScript Code Example: ```javascript const regex = /\p{Script=Greek}/u; console.log(regex.test('π')); // true ``` This addition provides functionality akin to Unicode matching in other programming languages like Python.
Template Literal Revision
Template Literal Revision relaxes the restrictions on escape sequences in template literals, allowing for more flexibility. ```javascript const str = `\u{61}bc`; console.log(str); // abc ``` This change makes template literals in JavaScript more powerful and less restrictive compared to similar string interpolation features in languages like Python and Ruby.
Conclusion
ECMAScript 2018 introduced several impactful features to JavaScript, enhancing its expressiveness and functionality. By incorporating feedback from developers and observing trends in software development, ES2018 has made JavaScript a more robust and developer-friendly language. For detailed exploration of all features and updates, the provided links to official resources are invaluable.
https://en.wikipedia.org/wiki/ECMAScript_version_history#ES2018
- Snippet from Wikipedia: ECMAScript version history
ECMAScript is a JavaScript standard developed by Ecma International. Since 2015, major versions have been published every June.
ECMAScript 2024, the 15th and current version, was released in June 2024.
JavaScript Version History: JavaScript, ECMAScript. ECMAScript 2022 (2022), ECMAScript 2021 (2021), ECMAScript 2020 (2020), ECMAScript 2019 (2019), ECMAScript 2018 (2018), ECMAScript 2017 (2017), ECMAScript 2016 (2016), ECMAScript 2015 (2015), ECMAScript 5.1 (2011), ECMAScript 5 (2009), ECMAScript 4 (2009), ECMAScript 3 (1999), ECMAScript 2 (1998), JavaScript 1.5 (2000), JavaScript 1.4 (1998), JavaScript 1.3 (1996), JavaScript 1.2 (1997), JavaScript 1.1 (1996, JavaScript 1.0 (1997. (navbar_javascript_versions - see also navbar_javascript, navbar_typescript_versions
JavaScript: JavaScript Fundamentals, JavaScript Inventor - JavaScript Language Designer: Brendan Eich of Netscape on December 4, 1995; JavaScript DevOps - JavaScript SRE, Cloud Native JavaScript (JavaScript on Kubernetes - JavaScript on AWS - JavaScript on Azure - JavaScript on GCP), JavaScript Microservices, JavaScript Containerization (JavaScript Docker - JavaScript on Docker Hub), Serverless JavaScript, JavaScript Data Science - JavaScript DataOps - JavaScript and Databases (JavaScript ORM), JavaScript ML - JavaScript DL, Functional JavaScript (1. JavaScript Immutability, 2. JavaScript Purity - JavaScript No Side-Effects, 3. JavaScript First-Class Functions - JavaScript Higher-Order Functions, JavaScript Lambdas - JavaScript Anonymous Functions - JavaScript Closures, JavaScript Lazy Evaluation, 4. JavaScript Recursion), Reactive JavaScript), JavaScript Concurrency (WebAssembly - WASM) - JavaScript Parallel Programming - Async JavaScript - JavaScript Async (JavaScript Await, JavaScript Promises, JavaScript Workers - Web Workers, Service Workers, Browser Main Thread), JavaScript Networking, JavaScript Security - JavaScript DevSecOps - JavaScript OAuth, JavaScript Memory Allocation (JavaScript Heap - JavaScript Stack - JavaScript Garbage Collection), JavaScript CI/CD - JavaScript Dependency Management - JavaScript DI - JavaScript IoC - JavaScript Build Pipeline, JavaScript Automation - JavaScript Scripting, JavaScript Package Managers (Cloud Monk's Package Manager Book), JavaScript Modules - JavaScript Packages (NPM and JavaScript, NVM and JavaScript, Yarn Package Manager and JavaScript), JavaScript Installation (JavaScript Windows - Chocolatey JavaScript, JavaScript macOS - Homebrew JavaScript, JavaScript on Linux), JavaScript Configuration, JavaScript Observability (JavaScript Monitoring, JavaScript Performance - JavaScript Logging), JavaScript Language Spec - JavaScript RFCs - JavaScript Roadmap, JavaScript Keywords, JavaScript Operators, JavaScript Functions, JavaScript Built-In Data Types, JavaScript Data Structures - JavaScript Algorithms, JavaScript Syntax, JavaScript OOP (1. JavaScript Encapsulation - 2. JavaScript Inheritance - 3. JavaScript Polymorphism - 4. JavaScript Abstraction), JavaScript Design Patterns - JavaScript Best Practices - JavaScript Style Guide - Clean JavaScript - JavaScript BDD, JavaScript Generics, JavaScript I/O, JavaScript Serialization - JavaScript Deserialization, JavaScript APIs, JavaScript REST - JavaScript JSON - JavaScript GraphQL, JavaScript gRPC, JavaScript on the Server (Node.js-Deno-Express.js), JavaScript Virtualization, JavaScript Development Tools: JavaScript SDK, JavaScript Compiler - JavaScript Transpiler - Babel and JavaScript, JavaScript Interpreter - JavaScript REPL, JavaScript IDEs (Visual Studio Code, JavaScript Visual Studio Code, Visual Studio, JetBrains WebStorm, JetBrains JavaScript), JavaScript Debugging (Chrome DevTools), JavaScript Linter, JavaScript Community - JavaScriptaceans - JavaScript User, JavaScript Standard Library (core-js) - JavaScript Libraries (React.js-Vue.js-htmx, jQuery) - JavaScript Frameworks (Angular), JavaScript Testing - JavaScript TDD (JavaScript TDD, Selenium, Jest, Mocha.js, Jasmine, Tape Testing (test harness), Supertest, React Testing Library, Enzyme.js React Testing, Angular TestBed), JavaScript History, JavaScript Research, JavaScript Topics, JavaScript Uses - List of JavaScript Software - Written in JavaScript - JavaScript Popularity, JavaScript Bibliography - Manning JavaScript Series- JavaScript Courses, JavaScript Glossary - JavaScript Official Glossary, TypeScript, Web Browser, Web Development, HTML-CSS, JavaScript GitHub, Awesome JavaScript, JavaScript Versions. (navbar_javascript - see also navbar_web_development, navbar_javascript_versions, navbar_javascript_standard_library, navbar_javascript_libraries, navbar_javascript_reserved_words, navbar_javascript_functional, navbar_javascript_concurrency, navbar_javascript async)
© 1994 - 2024 Cloud Monk Losang Jinpa or Fair Use. Disclaimers
SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.