- Home
- Interview Questions
- Javascript
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.
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.
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.
Most definitely; in fact, such calls can be nested as deeply as you need them to be.
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
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
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.
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.
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.
JavaScript does not directly support associative arrays (arrays with named indexes). However, there are ways to simulate their behavior by using objects.