How a toddler can learn new languages/accents quickly

Age- 3.5 years
Gender- Female

I have been observing a child of 3 years old and the ability of language learning. During lockdown she was used to hours of watching television and in which she was exposed to a lot of American accent cartoons and she had adapted the accent so quickly and readily that her way of speaking is different from others now. Similarly the way she speaks Indian languages such as Hindi and Marathi had an accent to it. Lately she has been watching a lot of Indian based cartoons and the change of accent has been drastic, it is amazing to not how her accent has been changing throughout by just watching visuals and audio of certain imaginary characters.