Skip to main content

ES6

Explore practical guides and implementation patterns for this topic.

Posts

Topic LWC
Lightning Web Components

How to Use JavaScript Sets and Maps in Salesforce LWC

In plain words: A Set is a collection of unique values used to remove duplicates, while a Map is a collection of key-value pairs used for fast data lookups. Because Salesforce Lightning Web Components (LWC) are built on modern JavaScript (ES6), you can use native Sets and Maps directly in your controller files to write cleaner, more efficient code. When manipulating data in Salesforce Lightning Web Components (LWC), developers often rely heavily on standard Arrays and Objects. However, modern JavaScript provides two highly optimized data structures that can make your code significantly better: Sets and Maps . Whether you need to extract a list of unique Record IDs or map Account names to their respective revenue numbers, knowing how to leverage Sets and Maps will instantly elevate your LWC development skills.
Read article
Topic LWC
Lightning Web Components

Advanced JavaScript Methods for Salesforce LWC Developers

In plain words: When fetching records from Apex in LWC, the data is delivered as JavaScript arrays. You don't need clunky for loops to manage this data. Use find() to grab a single record, some() to check rules, map() to format data for your datatables, filter() to narrow down lists, and reduce() for math totals. If you are writing JavaScript for Salesforce Lightning Web Components (LWC), you spend a lot of time organizing data. You might need to locate a specific record, validate user inputs, format fields for the UI, filter a list, or sum up a column. Modern JavaScript handles all of this natively without requiring long, messy loops. This guide walks you through the essential JavaScript array methods you need for LWC, updated for modern standards, complete with real-world Salesforce data examples.
Read article
Topic LWC
Lightning Web Components

Essential Array Methods in JavaScript for Salesforce LWC: forEach, filter, map, and reduce

In plain words: When developing Salesforce Lightning Web Components (LWC), you constantly handle lists of data returned from Apex. Instead of writing messy, traditional for loops to parse and transform your records, modern JavaScript gives you four foundational array methods— forEach , filter , map , and reduce —to write clean, readable, and maintainable code. Welcome to Part 4 of our series on essential JavaScript methods for Salesforce Lightning Web Components (LWC). Writing high-performing frontend applications relies on your ability to process data efficiently on the client side. In this guide, we will break down the four most critical array manipulation methods every Salesforce developer must master.
Read article