- Faster performance
- Rich interfaces
- Minimal server interaction
- Rich interfaces
4. Define undefined and undeclared variables
Undeclared variables are variables that are not declared and do not exist in the code. It throws a runtime error when we try to use undeclared variables.
Undefined variables are variables that are declared but not defined which means there is no value assigned. When we try to use undefined variables, it returns an undefined number.
5. What is the use of PromptBox?
PromptBox is used when a user needs to input any value. It is a dialog that contains an input field along with OK or CANCEL buttons.
6. What is the difference between == and === operator?
The equalsTo (==) operator checks if the values of both variables are equal.
The strictly equalsTo(===) operator not only checks the values but also its datatypes.
7. What is the parseInt function?
The parseInt() function converts from numbers of different bases to an integer number.
8. What is the difference between void(0) and void()?
We use void(0) to prevent the page to refresh whereas void() is a keyword that indicates that the function does not return any value.
We can group the data types as below:
- Primitive data types
- Reference data types
10. What is a Blur function?
A blur function removes the focus from a specific object.
- Runtime errors: When HTML command is incorrect
- Logical errors: Due to the wrong logics that we apply
- Load time errors: When an error occurs due to incorrect syntax during webpage loading
12. What is the difference between SessionState and ViewState?
SessionState is applicable for specific user data across all web pages whereas ViewState is applicable only for a webpage of a session.
The push method is used along with the Array data type to insert an element at the end. We can also use it to add multiple elements together.
A Callback function is triggered during a specific state that contains some method and arguments.
16. What is the use of isNan function?
Nan stands for Not a number. Hence this function checks if the argument passes is not a number and return true if the condition is met.
The major drawback of using the true private method is, it creates a new method for every instance and hence results in poor memory efficiency.
A closure is a function inside a parent function that has access to all defined and declared variables within the parent scope.
- block statement
- break statement
- continue statement
- do..while statement
- for statement
- Array object: Used for data processing
- String object: Used with String values
- Date object: Used for date and time manipulation
- Number object: Works with numeric data
- Math object: Used for mathematical operations
- RegExp object: For pattern text matching
- Boolean object: Represents true or false values
- Function object: Small piece of code that performs some functionality
- object Object: creates custom objects
23. What is an anonymous function?
An anonymous function is a function that does not have any name. It resides within a variable name and hence we can call this only using the variable name.
24. What is a Generic function?
25. What are the different types of popup boxes?
- Confirmation box: Uses the method confirm()
- Alert box: Uses the method alert()
- Prompt box: Uses the method prompt()
A cookie stores browser data as variables in the client’s computer. Whenever we browse a page, it retrieves and stores the cookies too which is used for faster and better user responses.
When we call one statement within another, we call it chaining or cascading.
29. What is the main difference between the “var” and “let” keyword?
The var keyword has scope within the function while the let keyword has scope within the block.
30. What is the output of the evaluation 3+8+”2″?
The output is 112. This is because it performs evaluation from left to right and appends the string to the result.
31. What do you mean by the Unshift method?
The Unshift method insert values to the front of the array and can be used to retrieve the length of the array.
32. Which method returns a character at the specified index?
We can use the charAt() method to retrieve a character at the specified index.
This keyword refers to the current instance or object. When this keyword is used within a method, it refers to the owner object and within a function, it refers to the global object.
The number that we obtain by diving an integer by zero is called negative infinity.
The escape character is represented by “\” backslash that is used to print special characters like double quotes, single quotes, apostrophe, and ampersand. We just need to place “\” before the required character.
We can use the Navigator.appversion to determine the operating system in the client machine.
39. What is the use of typeof operator?
The typeof operator returns the string description of the datatype of the variable.
40. What is variable typing?
Variable typing is the process of assigning a number and string to the same variable.