concept diode in category javascript

This is an excerpt from Manning's book JavaScript on Things: Hacking hardware for web developers.
Building projects involves a certain amount of electronic gear: development boards, input and output components, basic electronic components like resistors and diodes, power connections, and basic tools.
There’s a standard method for accomplishing this, using a diode (figure 6.11). You briefly met diodes in chapter 2—LEDs are a kind of diode. A diode is a semiconductor component that only allows current to flow through it in one direction.
The diode placement in the circuit wiring diagram for the pushbutton-controlled motor we’re about to construct—with the diode’s cathode connected to the positive power rail—looks backwards, and it is (figure 6.12).
The way the diode is oriented (“backwards,” or, more technically, reverse-biased) in the circuit means that current will be blocked from flowing through it—usually. But when the back-voltage situation arises, and the flow through the circuit is topsy-turvy, the diode becomes temporarily forward-biased—it’s momentarily oriented so that current can flow across it. At these times, it can create a path to “wick away” dangerous negative voltage current and reroute it through the motor over and over again until the negative voltage dissipates naturally on its own (don’t worry, it will, and quickly).
Diodes and capacitors are two components that can help build safer motor circuits. Diodes only allow current to flow through them in one direction. A diode, oriented to be reverse-biased in parallel with a motor, can protect the circuit, acting as a flyback diode.