Home > Articles > Open Source > Ajax & JavaScript

  • Print
  • + Share This
This chapter is from the book

Q&A

  • Q. Some of the listings and code snippets list opening and closing <script> tags on the same line; other times they are on separate lines. Does it matter?

    A. Empty spaces, such as the space character, tabs, and blank lines, are completely ignored by JavaScript. You can use such blank space, which programmers usually call whitespace, to lay out your code in such a way that it’s more legible and easy to follow.

  • Q. Can I use the same <script> element both to include an external JavaScript file and to contain JavaScript statements?

    A. No. If you use the script element to include an external JavaScript file by using the src attribute, you cannot also include JavaScript statements between <script> and </script>—this region must be left empty.

  • + Share This
  • 🔖 Save To Your Account