Use aura:id to add a local ID of button1 to the lightning:button component. You can find the component by calling cmp. find(“button1”) , where cmp is a reference to the component containing the button. The find() function has one parameter, which is the local ID of a component within the markup.
component.find() : returns the Aura.Component instance by its local ID. If the Aura.component local ID is unique, it returns the component, and if there are multiple Aura.component with the same local ID, it returns an array of the components.
Syntax: component.find(“auraid”);