How does JavaScript rendering work?