-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
41 lines (29 loc) · 861 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
What do I need this to do?
put event handlers and functions on my buttons in index.HTML to...
send a fetch request to localhost/marco. That's it.
Destructive Marco will send looped fetch requests. It's meant to DDOS the Polo API backend.
*/
// Setup stuff.
console.log("JS is loading")
const marcoButton = document.getElementById('marco');
const destructiveMarcoButton = document.getElementById('destructiveMarco');
marcoButton.addEventListener("click", sayMarco);
destructiveMarcoButton.addEventListener("click", yellMarco);
function sayMarco(){
console.log('Marco!')
marco();
};
function yellMarco(){
console.log('MARCO!')
for(let counter = 0; counter < 500; counter++){
marco();
}
};
function marco(){
fetch('/marco', {
method: 'GET',
})
.then(result => result.json())
.then(result => console.log(result))
}