A leading underscore signals that a property, variable, or method is intended for internal use. It communicates an API boundary by convention, but it does not prevent outside code from accessing the identifier. section 8.1 section 3.2
Internal rendering method
A component may expose add(item) while reserving _addItemToUI(item) for internal rendering. Calling the internal method directly can add an element without updating the component’s data model, so later redraws may remove it. section 8.1
Use the convention to make an intended boundary visible:
- Store internal state in names such as _searchTerm and _apiKey. section 3.2
- Expose searchTerm through a setter while keeping _searchTerm as the underlying value; the setter can trigger doSearch(). section 3.2
- Treat the underscore as guidance rather than access control; outside code can still call or modify the member. section 8.1
Listing 3.7. Getters and setters for our component’s configurable options
set apiKey(value) { #1
this._apiKey = value;
this.doSearch();
}
set searchTerm(value) { #2
this._searchTerm = value;
this.doSearch();
}
The setter example shows how an underscore-prefixed field can remain internal while a simple public property runs component logic. section 3.2

