The ArcGIS JavaScript API has a viewshed analysis sample that calculates a viewshed after clicking the scene view. The geoprocessor takes an Input_Observation_Point and a Viewshed_Distance, executes its task, and draws the viewshed:
var params = {
Input_Observation_Point: featureSet,
Viewshed_Distance: vsDistance
};
gp.execute(params).then(drawResultData);
Here is the geoprocessor: https://sampleserver6.arcgisonline.com/arcgis/rest/services/Elevation/ESRI_Elevation_World/GPServer/Viewshed
Does the Input_Observation_Point parameter have any variables for height? If so, how can I set it in the sample program?