JavaScript

Every component must have a JavaScript file. JavaScript files in Lightning web components are ECMAScript 6 (ES6) modules.

In this section, you can learn how to:

For documentation on JavaScript functions, see the Mozilla Developer Network (MDN) JavaScript Reference.

To speed up your LWC development, it's helpful for you to be familiar with these JavaScript features.

Many of our examples in lwc-recipes and in this developer guide now use async/await instead of promises. async/await helps you write code that's more intuitive and resembles synchronous code. async/await is compatible with ordinary try/catch blocks around asynchronous code.

LWC is an abstraction layer on top of Web Component APIs that simplifies your developer experience and improves productivity. To learn about LWC best practices, see Best Practices for Development with Lightning Web Components.