How to send variables from a php file to another file in java script [duplicate]

I recently began to learn about web developement, and I notoriously created a website as a training which consists of typing as fast as possible the words that appear successively on screen. All the code was in html, css and javascript.

This week, I began to learn the basis of PHP. As my first website is quite limited (the words asked were always the same), I want to link a database of words to my project – and to do so, I would like to use php and MySQL. But here’s my issue : all the management of the words asked is made in js, which means that I would need to send some php variables to js.

To be honest, I don’t know how to do that. I don’t see how I could link both files. Does anybody knows how I could transfer the obtained php variables to js. I don’t really want to modify my html file as it could enable the users to directly access my variables.