Question:- In JavaScript what is an argument object?
Answer:- The variables of JavaScript represent the arguments that are passed to a function.
Question:- Define closure.
Answer:- In JavaScript, we need closures when a variable which is defined outside the scope in reference is accessed from some inner scope.
Question:- What is the difference between JavaScript and JScript?
Answer:- Netscape provided the JavaScript language. Microsoft changed the name and called it JScript to avoid the trademark issue. In other words, you can say JScript is the same as JavaScript, but Microsoft provides it.
Question:- What are the key differences between Java and JavaScript? / How is JavaScript different from Java?
Answer:- JavaScript is a lightweight programming language (most commonly known as scripting language) developed by Netscape, Inc. It is used to make web pages interactive. It is not a part of the Java platform. Following is a list of some key differences between Java and JavaScript
Question:- Which of the following is the correct syntax of the eval() function? a.[objectName.]eval(numeric) b.[EvalName.]eval(string) c.[EvalName.]eval(numeric) d.[objectName.]eval(string)
Answer:- Answer: D is the correct option. The eval() function is used to evaluate or execute an argument. If the argument is an expression, the eval() function evaluates the expression. If the argument is one or more JavaScript statements, the eval() function executes the statements.
Question:- Is JavaScript case sensitive language?
Answer:- Yes, JavaScript is a case sensitive language.
Question:- What is BOM?
Answer:- BOM stands for Browser Object Model. It provides interaction with the browser. The default object of a browser is a window. So, you can call all the functions of the window by specifying the window or directly. The window object provides various properties like document, history, screen, navigator, location, innerHeight, innerWidth,
Question:- What is DOM? What is the use of document object?
Answer:- DOM stands for Document Object Model. A document object represents the HTML document. It can be used to access and change the content of HTML.
Question:- What is the use of window object?
Answer:- The window object is created automatically by the browser that represents a window of a browser. It is not an object of JavaScript. It is a browser object. The window object is used to display the popup dialog box.
Question:- What is the use of history object?
Answer:- The history object of a browser can be used to switch to history pages such as back and forward from the current page or another page. There are three methods of history object. 1.history.back() - It loads the previous page. 2.history.forward() - It loads the next page. 3.history.go(number) - The number may be positive for forward, negative for backward. It loads the given page number.
Question:- How to write a comment in JavaScript?
Answer:- There are two types of comments in JavaScript. 1. Single Line Comment: It is represented by // (double forward slash) 2. Multi-Line Comment: Slash represents it with asterisk symbol as /* write comment here */
Question:- How to create a function in JavaScript?
Answer:- To create a function in JavaScript, follow the following syntax. function function_name(){ //function body }
Question:- What are the different data types present in JavaScript?
Answer:- There are two types of data types in JavaScript: 1. Primitive data types 2. Non- Primitive data types
Question:- What are the Primitive data types?
Answer:- The primitive data types are as follows: 1. String: The string data type represents a sequence of characters. It is written within quotes and can be represented using a single or a double quote. 2. Number: The number data type is used to represent numeric values and can be written with or without decimals. 3. Boolean: The Boolean data type is used to represent a Boolean value, either false or true. This data type is generally used for conditional testing. 4. BigInt: The BigInt data type is used to store numbers beyond the Number data type limitation. This data type can store large integers and is represented by adding "n" to an integer literal. 5. Undefined: The Undefined data type is used when a variable is declared but not assigned. The value of this data type is undefined, and its type is also undefined. 6. Null: The Null data type is used to represent a non-existent, null, or a invalid value i.e. no value at all. 7. Symbol: Symbol is a new data type introduced in the ES6 version of JavaScript. It is used to store an anonymous and unique value. 8. typeof: The typeof operator is used to determine what type of data a variable or operand contains. It can be used with or without parentheses (typeof(x) or typeof x). This is mainly used in situations when you need to process the values of different types.
