The Map.addLayer() visualization parameters are expected to be client-side JS objects, but you are providing server-side EE objects (ee.Number). Use the .evaluate() function to convert server-side objects to client-side objects.
Here, I've included the computed min and max values in an ee.Dictionary object and applied the .evaluate() function to it. A client-side dictionary object (dict) is made available within the scope of the anonymous function, where the min and max values can then be referenced and set as visualization parameters for displaying the image to the Map.
var fc = ee.FeatureCollection('TIGER/2018/States') .filter(ee.Filter.and(ee.Filter.eq('NAME', 'Utah'))); var DEM = ee.Image('USGS/NED').clip(fc); var Terrain = ee.Terrain.products(DEM).select('slope'); print(Terrain); var visPct = Terrain.reduceRegion({ reducer: ee.Reducer.percentile([5,95]).setOutputs(['min','max']), geometry: fc, scale: 10, bestEffort: true }); // ######################################################### // ### ▼ EDITED ▼ ### // ######################################################### var minMax = ee.Dictionary({ minVal: visPct.getNumber('slope_min'), maxVal: visPct.getNumber('slope_max') }); print(minMax); minMax.evaluate(function(dict) { var vizParams = { min: dict.minVal, max: dict.maxVal, palette: ['blue','green','Yellow','red'] }; Map.centerObject(fc); Map.addLayer(Terrain, vizParams, 'Shaded'); });