ArcGIS API for JavaScript: Hosted/closestPnt (FeatureServer)

Built using the ArcGIS API for JavaScript