Home
1.
Won’t the inclusion of JavaScript code slow down the load time of my pages?

Yes, though usually the difference is small enough not to be noticeable. If you have a particularly large piece of JavaScript code, you may feel it’s worthwhile testing your page on the slowest connection a user is likely to have. Other than in extreme circumstances, it’s unlikely to be a serious issue.

2.
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?

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.

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

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.

4.
Can one function contain a call to another function?

Most definitely; in fact, such calls can be nested as deeply as you need them to be.

5.
What characters can I use in function names?

Function names must start with a letter or an underscore and can contain letters, digits, and underscores in any combination. They cannot contain spaces, punctuation, or other special characters

6.
Does Date() have methods to deal with time zones?

Yes, it does. In addition to the get...() and set...() methods discussed in this hour (such as getDate(), setMonth(), etc.) there are UTC (Universal Time, previously called GMT) versions of the same methods (getUTCDate(), setUTCMonth(), and so on). You can retrieve the difference between your local time and UTC time by using the getTimezoneOffset() method

7.
Why does Date() have the methods called getFullYear() and setFullYear() instead of just getYear() and setYear()?

The methods getYear() and setYear() do exist; they deal with two-digit years instead of the four-digit years used by getFullYear() and setFullYear(). Because of the potential problems with dates spanning the millennium, these functions have been deprecated. You should use getFullYear() and setFullYear() instead.

8.
What is the maximum length of a string in JavaScript?

The JavaScript Specification does not specify a maximum string length; instead, it will be specific to your browser and operating system. For certain implementations, it will be a function of available memory.

9.
Does JavaScript have a data type to represent a single character?

No, unlike some other languages JavaScript doesn’t have a specific data type to represent a single character. To do this in JavaScript, you create a string that consists of only one character.

10.
Does JavaScript allow associative arrays?

JavaScript does not directly support associative arrays (arrays with named indexes). However, there are ways to simulate their behavior by using objects.