The process is very similar to the one used in the sample linked to below but in your case you'll want to create a new Extent geometry and add it as a graphic to the map
Select with Feature Layer | ArcGIS API for JavaScript 3.20