The micro:bit does not have a special light sensor device fitted. However, it can use the LEDs of the matrix display to estimate the amount of ambient light. Using the editors, yo can return a light level value (0-255) that you can use in your program.
MakeCode Editor
The light level block can be found under Input
As an example, the light level could be asigned to a variable
Python Editor
The light level can be read using display.read_light_level()
for example:
from microbit import *
while True:
lightLevel = display.read_light_level()
display.scroll(lightLevel)
sleep(2000)
Examples of light sensing can be found in the micropython documentation
Further Information
Documentation https://tech.microbit.org/hardware/#display and https://lancaster-university.github.io/microbit-docs/ubit/display/#readlightlevel
This light sensing method uses an LED both as an output device, and an input device. When the output pin of the microprocessor drives a voltage across the LED, the LED lights up. If the micro-controller then sets that drive pin as an input, and times how long it takes for the voltage at the top end of the LED to collapse, that time is roughly proportional to the amount of ambient light. This method should be considered an approximation of the light level and will not be as accurate as using a dedicated light sensor such as an Light Dependent Resistor (LDR).
There is some background into the general technique in these links, which include details on not just how to sense ambient light with LEDs, but how to transfer small amounts of data wirelessly using the same technique.
https://www.sparkfun.com/news/2161
http://www.merl.com/publications/docs/TR2003-35.pdf
http://electronics.stackexchange.com/questions/902/detecting-light-with-an-led
http://www.instructables.com/id/LEDs-as-light-sensors/
Keywords for search: light sensing, light sensor, measure light level