1// Alert used to display a message to the user.
2alert("Hello, World!"); // Displays Hello, World! to the user.
3// You can also use:
4window.alert("Hello, World!"); // Also displays Hello, World! to the user.
1//you can either do this:
2
3function mousePressed() {
4 //you can have any message
5 alert("I'm the best");
6}
7
8//or you can do this:
9
10function keyPressed() {
11 //you can do any key
12 if (keyCode === UP_ARROW) {
13 //and any message
14 alert(number = random(0, 500));
15 }
16}
17
18//or you can do an (if) statement
19
20if(x > width) {
21 alert("yay you did it");
22}