Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In the following snippet function pageLoad(){} window.onload=pageLoad; The assig

ID: 3938428 • Letter: I

Question

In the following snippet

function pageLoad(){} window.onload=pageLoad;

The assignment of the pageLoad as the event handler for window onload events lacks the open and close parentheses that would normallybe associated with pageLoad() because

a)in contast to the LISP (lots of insidious single parentheses) paradigm, this reduces the number of paratheses required

b) this is an invocation of the pageLoad function, not an assignment

c) the designers of the JavaScript language wanted to reduce the syntactic baggage associated with the statement

d) this is an invocation of the onload function not an assignment

e) this is an assignment and not an invocation of the pageLoad function

Explanation / Answer

b) this is an invocation of the pageLoad function, not an assignment

The syntax window.onload=pageLoad; makes sure that the entire page and all of its related files and components are loaded before the function pageLoad() which is present in the onload event handler is executed.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote