Source: Me. I currently work as a systems engineer on JWST.
JWST will operating from the 2nd Lagrange Point (aka L2), which is approximately 1.5 million km (or 930,000 miles) past the Earth in Sun-Earth line. This is approximately 4x the distance from the Earth to the Moon. This distance, in addition to its lissajous orbit, ensures it will not encounter any Lunar Night, and its solar array will remain in sun.
Regarding its operational temperature, you have to understand JWST has three clearly defined thermal regions, and a transitional region. Region 3 is the spacecraft compartment. This houses all the main spacecraft subsystems/electronics (main computer, communications system, attitude control, etc, as well as the main instrument computer and cryocoolers). This region is in continuous sun, so operates anywhere from 0-40°C, depending on the location in orbit and efficiency of thermal dissipation. The battery is also housed in Region 1, so will never experience the drastic cold.
With the 5-layer sunshield, there is a transition area to go from the "hot" sun side to the cryogenic cold side. Note that this is a very steep temperature transition, so materials and cabling have to withstand all this, plus the cryocooler lines.
Region 1 is the "cold" part of the observatory, and encompasses the mirrors and actuators and the instruments (meaning all their mechanical parts and their detectors), the support structure, and various heaters, harnesses, and thermal conductors. Here the temperature will passively reduce below 30 K, save for the heaters that keep the instruments at their operating temperatures, and the cryogenic instrument, which goes down to 6 K. The instrument mechanisms are all designed to work at these low temperatures, and the focal plane systems are also specially designed for these temperatures as well, with some immediate/local processing.
Region 2 is located off the back of Region 1. It contains the instrument electronics boxes (outside the main instrument computer), and a couple other support electronics boxes. This is a very-well insulated box with baseplate heaters to maintain it at >0°C, so compared to Region 1 it is quite warm! It also contains specialized, directional radiators that help shed heat from Region 1 into deep space for cooling down and maintaining operational temperature.
Keep in mind that all of these thermal regions are existing at the same time on JWST, although most of the electronics are kept fairly warm. Between 4 cryo-vacuum tests and a thermal vacuum test, the major components of all these have been successfully tested.
Regarding thermal cycling and tin whiskers, NASA (and by extension, its contractors) require usage of specific solders and conformal coatings to mitigate tin whiskers and Paschen discharge. Additionally, once up there and everything has cooled to its operational temperature, JWST's various regions will remain at their temperature within several kelvins (for heater cycling and seasonal/orbital effects), barring any incidents.