Reclassifying raster values in Google Earth Engine?

ee.Image.remap() operates on individual values, not ranges of numbers like your example shows.

Given that you are trying to convert the slope values to a set of bins with equal spacing, you can just divide and set it next highest integer using ee.Image.ceil().

// Add features.
var feature = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017")
             .filter(ee.Filter.eq('country_na', 'Switzerland'));

// Add raster.
var elev = ee.Image("USGS/SRTMGL1_003");

// Get slope.
var slopesmrt = ee.Terrain.slope(elev);

// Remap values.
var slopereclass = slopesmrt.divide(10).ceil();

// Display the result.
Map.addLayer(slopesmrt.clip(feature), {min: 0, max: 90, palette: ['black', 'white']},'slope');
Map.addLayer(slopereclass.clip(feature), {min: 1, max: 9, palette: ['black', 'red']}, 'slopereclass');

The accepted solution addresses the very specific case at hand, and while admirably clever (kudos for that), does not answer the question, which is "How to reclass ranges in GEE".

A more general case of reclassification of ranges into user specific classes would be with conditional assignment using where

// Add features.
var feature = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017")
             .filter(ee.Filter.eq('country_na', 'Switzerland'));

// Add raster.
var elev = ee.Image("USGS/SRTMGL1_003");

// Get slope.
var slopesmrt = ee.Terrain.slope(elev);

// Remap values.
var slopereclass = ee.Image(1)
          .where(slopesmrt.gt(10).and(slopesmrt.lte(20)), 2)
          .where(slopesmrt.gt(20).and(slopesmrt.lte(30)), 3)
          .where(slopesmrt.gt(30).and(slopesmrt.lte(40)), 4)
          .where(slopesmrt.gt(40).and(slopesmrt.lte(50)), 5)

...and so on. Clearly, more to write but now I could specify any class range I want.