JAVASCRIPT EXAM STUDY
QUESTIONS AND ANSWERS
how do you insert Javascript into a web page? - ANSWER-with the script tag:<script
type="text/javascript">document.write("Hello World!");</script>
Where do you put javascripts? - ANSWER-in the head or body sections.
When do javascripts execute? - ANSWER-immediately. as the page loads into the browser.
What if you don't want the script to execute immediately upon loading a page? - ANSWER-then
put it inside a function.
where do you place functions and why? - ANSWER-in the head section, this way they are all in
one place, and they do not interfere with page content.
when should scripts be placed in the body? - ANSWER-when you want your script to be placed
inside a function, or if your script should write page conten.
how many scripts can you have in a document? - ANSWER-an unlimited number.
when should you use an external javascript? - ANSWER-when you want to run the same
JavaScript on several pages, without having to write the same script on every page.
how should an external javascript be referenced? - ANSWER-<script type="text/javascript"
src="xxx.js"></script>. name the file with a .js extension.
can the external script contain the <script></script> tags? - ANSWER-No.
where do you place the reference for the external javascript in the html page? - ANSWER-
exactly where you would if it was not external.
what is javascript? - ANSWER-a sequence of statements to be executed by the browser
is javascript case sensitive? - ANSWER-yes
what is a javascript statement? - ANSWER-A JavaScript statement is a command to a browser.
The purpose of the command is to tell the browser what to do.
is using a semi colon at the end of a statement mandatory> - ANSWER-No, but its good practice
and it allows you to write multiple statements on a line.
what sequence are javascript statements executed in? - ANSWER-the order they are written.
what is a javascript block? - ANSWER-a group of statements grouped by curly brackets
QUESTIONS AND ANSWERS
how do you insert Javascript into a web page? - ANSWER-with the script tag:<script
type="text/javascript">document.write("Hello World!");</script>
Where do you put javascripts? - ANSWER-in the head or body sections.
When do javascripts execute? - ANSWER-immediately. as the page loads into the browser.
What if you don't want the script to execute immediately upon loading a page? - ANSWER-then
put it inside a function.
where do you place functions and why? - ANSWER-in the head section, this way they are all in
one place, and they do not interfere with page content.
when should scripts be placed in the body? - ANSWER-when you want your script to be placed
inside a function, or if your script should write page conten.
how many scripts can you have in a document? - ANSWER-an unlimited number.
when should you use an external javascript? - ANSWER-when you want to run the same
JavaScript on several pages, without having to write the same script on every page.
how should an external javascript be referenced? - ANSWER-<script type="text/javascript"
src="xxx.js"></script>. name the file with a .js extension.
can the external script contain the <script></script> tags? - ANSWER-No.
where do you place the reference for the external javascript in the html page? - ANSWER-
exactly where you would if it was not external.
what is javascript? - ANSWER-a sequence of statements to be executed by the browser
is javascript case sensitive? - ANSWER-yes
what is a javascript statement? - ANSWER-A JavaScript statement is a command to a browser.
The purpose of the command is to tell the browser what to do.
is using a semi colon at the end of a statement mandatory> - ANSWER-No, but its good practice
and it allows you to write multiple statements on a line.
what sequence are javascript statements executed in? - ANSWER-the order they are written.
what is a javascript block? - ANSWER-a group of statements grouped by curly brackets