How does the Use Javascript function work?

I've been trying to toy around with using javascript but I'm a bit confused.
I know enough code to realize JS.whatever() is reffering to a javascript file so what kind of info would I put into the () to run a certain function?

The name of the JS function :?

So JS.Name refers to a function itself?

Ah, now I got it. You can pass parameter to the JS-function

JS.test("hello")


Javascript:

function test(text) {
alert(text);
}