in Education by
Why do we need to use an onload event in the script tag after using the async attribute? (a) Invoke code during page loading (b) Invoke code during script loading (c) Invoke code during downloading (d) Invoke code during reloading I got this question in a job interview. Asked question is from Script Loading in section Invocation and Performance Navigation of JavaScript Select the correct answer from above options JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
The correct answer is (c) Invoke code during downloading Easy explanation: When using async you don’t know when the file will be downloaded, so you can attach an onload event handler to the script tag. This will allow you to invoke or instantiate any code that will need to be run when the file is downloaded:

Related questions

0 votes
0 votes
0 votes
0 votes
    What is the type of datatype the async attribute optionally accepts? (a) Integer (b) String (c) ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
0 votes
    Why do we use Adobe Illustrator along with R? (a) Collect the relevant data (b) Format the chart ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 22, 2021 in Education by JackTerrance
0 votes
    Which of the following is an attribute to the script object? (a) onclick (b) onload (c) onshow ( ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
0 votes
0 votes
    The script tag must be placed in __________ (a) the head tag (b) the head or body (c) the title ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    What does the Minify return back to the Script tag? (a) File I/O (b) Minify JavaScript (c) HTTP ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
0 votes
    What is the return type of the script tag? (a) File I/O (b) Minify JavaScript (c) HTTP Request ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
0 votes
0 votes
    What is necessary when we need to create a new field in craft? (a) Type of the input (b) Type ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 22, 2021 in Education by JackTerrance
0 votes
    What will happen after executing the script? (a) Execute script (b) Layout positioning of DOM elements (c ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 22, 2021 in Education by JackTerrance
...