Combination of:
* memorize the gist of their lines and practice them before hand
* most actors are not on screen/stage all the time, so they get to review the script for the next scene before they do it.
* TV/Movies have the benefit of retakes and editing, so as long as an actor can memorize a few lines at a time they can still make it work.
Latest Answers