It is easy to think of sugar as just a sweetener, but it has nearly as many uses as salt does. Sugar enhances other flavors, especially in ice cream, and balances hot, bitter, and acidic flavors. Sugar provides color when it caramelizes; the caramelizing also creates a crust that retains some moisture to prevent food from drying out. It stabilizes beaten egg whites and makes cookies crisp. When sugar and shortening are "creamed" together at the beginning of a recipe, the sugar crystals trap air in small pockets that expand during baking, to create a light, airy texture; sugar also allows the air bubbles more time to form by slowing down the batter setting, and makes a cake more tender by combining with protein (which would otherwise make the batter stretchy, like a pizza crust).
Before refrigeration, sugar's most important characteristic may have been its tendency to soak up available moisture, thereby depriving bacteria of the moisture it needs to grow. This is why fruits and jellies can be preserved with canning, and why sugar or honey can be used as a rough-and-ready wound dressing. The sugar also enhances the color of canned fruit - and tastes good. No wonder so much of it is used in the kitchen.