Spectral Indices are central to many aspects of remote sensing. Whether you are studying vegetation or tracking fires - you will need to compute a pixel-wise ratio of 2 or more bands. The most commonly used formula for calculating an index is the  Normalized Difference between 2 bands. Earth Engine provides a helper function  normalizedDifference()  to help calculate normalized indices, such as Normalized Difference Vegetation Index (NDVI). For more complex formulae, you can also use the  expression()  function to describe the calculation.

Watch this video:

The code is available in this repository under Module4/Exercise1