Whats the "()" for in the mousePressed function?


#1

In the statement “function mousePressed()” whats the “()” for? Is it to define on what click what happens like this?: "mousePressed(1) unmute(“Whatever.mp3”)
"mousePressed() mute(“WhateverAgain.mp3”)

Thanks in Advance


#2

Hey @Judah_Wharton. This is the syntax for creating functions in JavaScript. (Check out this article for more details on that https://www.w3schools.com/js/js_functions.asp)

When defining a custom function, you can add “parameters” inside of those parentheses to allow information to be passed to that function.


#3

thank you! it helped me a lot.