As a complete Javascript novice I’m challenged by some simple concentps.
When I’m doing my javascript I’ll often see stuff like this
function name(e) {
if(e.KeyCode) {
....
}
}
What does doing this accomplish? What’s the e all about?
Seems like the function is to be called by the browser (or whatever) when firing a specific event (in this case I guess it’s keyboard related; e stands for event or event data).
So once fired, the caller will pass the event structure as a parameter (copied to e). JavaScript won’t define any local/global variables just for the one specific call so KeyCode won’t be defined but e contains that variable.