event keyword in JavaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

event keyword in JavaScript

1_all event types inherits from Event object. 2_Some event types inherits from UI event object Are the two phrases above correct? and what is the event keyword?

19th Jan 2021, 9:37 PM
Mehran
Mehran - avatar
8 Answers
+ 2
مهران رئیسی That's interesting. This StackOverflow discussion gives more detail. https://stackoverflow.com/questions/1510094/is-event-a-reserved-word-in-javascript/14024400 Look at jhurshman answer
20th Jan 2021, 12:18 PM
Ore
Ore - avatar
+ 1
Both statements are correct. But I am not aware of any event keyword. Are you talking about the deprecated event function?
20th Jan 2021, 6:31 AM
Ore
Ore - avatar
+ 1
event keyword https://code.sololearn.com/WYmpm526ps0J/?ref=app i think event keyword is refer to event type object. is right?
20th Jan 2021, 7:31 AM
Mehran
Mehran - avatar
+ 1
I corrected it
20th Jan 2021, 8:36 AM
Mehran
Mehran - avatar
+ 1
no. event passed automatically. you should have touched the word in my code.
20th Jan 2021, 9:35 AM
Mehran
Mehran - avatar
+ 1
That's a good discussion. Thank you
20th Jan 2021, 12:57 PM
Mehran
Mehran - avatar
0
مهران رئیسی I didn't find any event keyword in your code. onclick is an HTML attribute that allows JavaScript to listen for click events on the element.
20th Jan 2021, 8:24 AM
Ore
Ore - avatar
0
مهران رئیسی Your program does not work. event.target is only available if your event handler has at least one parameter. Look at this code I created https://code.sololearn.com/Wwt50NG8BOs6/ I have used addEventListener to add my event listener. That enables me to pass my load function has a callback instead of calling it manually. When using addEventListener, your event listener first argument is an Event object. This old chapter from a book published in 2009 talks about the event object. https://www.peachpit.com/articles/article.aspx?p=1394321&seqNum=3 Note that the first parameter, event, can be named anything. Which means that the below code will work function load (e) { e.target.innerHTML = "..."; }
20th Jan 2021, 8:57 AM
Ore
Ore - avatar