0

when I executed the java script code in my website, and then I checked the a bunch of properties are coming.

document.addEventListener("keypress",function(e){
  console.log(e);
})

but i don't know what the e does. like I know that usually we use a parameter to modify something inside a function, but why is it automatically showing all the properties that happened?

this is the result I get in the console if I executed the code in my website and then pressed some random keys

index.js:30 KeyboardEvent {isTrusted: true, key: "f", code: "KeyF", location: 0, ctrlKey: false, …}
index.js:30 KeyboardEvent {isTrusted: true, key: "d", code: "KeyD", location: 0, ctrlKey: false, …}
index.js:30 KeyboardEvent {isTrusted: true, key: "a", code: "KeyA", location: 0, ctrlKey: false, …}
index.js:30 KeyboardEvent {isTrusted: true, key: "f", code: "KeyF", location: 0, ctrlKey: false, …}
index.js:30 KeyboardEvent {isTrusted: true, key: "a", code: "KeyA", location: 0, ctrlKey: false, …}
index.js:30 KeyboardEvent {isTrusted: true, key: "d", code: "KeyD", location: 0, ctrlKey: false, …}
index.js:30 KeyboardEvent {isTrusted: true, key: "f", code: "KeyF", location: 0, ctrlKey: false, …}
index.js:30 KeyboardEvent {isTrusted: true, key: "a", code: "KeyA", location: 0, ctrlKey: false, …}
index.js:30 KeyboardEvent {isTrusted: true, key: "d", code: "KeyD", location: 0, ctrlKey: false, …}
index.js:30 KeyboardEvent {isTrusted: true, key: "d", code: "KeyD", location: 0, ctrlKey: false, …}
index.js:30 KeyboardEvent {isTrusted: true, key: "a", code: "KeyA", location: 0, ctrlKey: false, …}

I have no idea what is happening.

VLAZ
  • 22,934
  • 9
  • 44
  • 60

0 Answers0