Question:- What is the use of a TypedArray object in JavaScript?
Answer:- The JavaScript TypedArray object illustrates an array like a view of an underlying binary data buffer. There is any number of different global properties, whose values are TypedArray constructors for specific element types.
Question:- What is the use of a Set object in JavaScript?
Answer:- The JavaScript Set object is used to store the elements with unique values. The values can be of any type i.e. whether primitive values or object references.
Question:- What is the use of a WeakSet object in JavaScript?
Answer:- The JavaScript WeakSet object is the type of collection that allows us to store weakly held objects. Unlike Set, the WeakSet are the collections of objects only. It doesnt contain the arbitrary values.
Question:- What is the use of a Map object in JavaScript?
Answer:- The JavaScript Map object is used to map keys to values. It stores each element as key-value pair. It operates the elements such as search, update and delete on the basis of specified key.
Question:- What is the use of a WeakMap object in JavaScript?
Answer:- The JavaScript WeakMap object is a type of collection which is almost similar to Map. It stores each element as a key-value pair where keys are weakly referenced. Here, the keys are objects and the values are arbitrary values.
Question:- What are the falsy values in JavaScript, and how can we check if a value is falsy?
Answer:- Those values which become false while converting to Boolean are called falsy values. const falsyValues = [', 0, null, undefined, NaN, false]; We can check if a value is falsy by using the Boolean function or the Double NOT operator (!!).
Question:- What do you understand by hoisting in JavaScript?
Answer:- Hoisting is the default behavior of JavaScript where all the variable and function declarations are moved on top. In simple words, we can say that Hoisting is a process in which, irrespective of where the variables and functions are declared, they are moved on top of the scope. The scope can be both local and global.
Question:- Which of the following statement shows the primary difference between JavaScript and Java? a. There is no difference between JavaScript and Java. b. Functions are considered as fields. c. Variables are specific. d. Functions are values, and there is no such distinction between methods and fields.
Answer:- D is the correct option. We know that Java is an OOP language while JavaScript is an OOP scripting language. The most fundamental difference between JavaScript and Java is that the functions are values, and there is no such distinction between methods and fields.
Question:- Which of the following syntax is valid for creating a RegExp object? 1. var txt=new RegExp(pattern,attributes); 2. var txt=/pattern/attributes; a. Only 1 syntax b. Only 2 syntax c. Both 1 and 2 syntax d. None of the above
Answer:- C: Both the statements are correct and can be used for creating a RegExp object.
Question:- Which of the following statement specifies the meaning of Augmenting classes? a. Objects inherit prototype properties even in a dynamic state. b. Objects inherit prototype properties only in a dynamic state. c. Objects inherit prototype properties in the static state. d. An object doesnt inherit prototype properties in the static state.
Answer:- A: "Objects inherit prototype properties even in a dynamic state" is the correct answer.
Question:- If para1 is the DOM object for a paragraph, which of the following would be the correct syntax to change the text within the paragraph? a. para1="New Text" b. firstChild.nodeValue= "New Text"; c. value="New Text"; d. nodeValue="New Text";
Answer:- C: "para1.value="New Text";" is the correct syntax to change the text within the paragraph.
Question:- Which of the following is used to define the behavior of the instances present of a class inside a method? a. Method b. Classes c. Interfaces d. Classes and Interfaces
Answer:- B: "Classes" is the correct answer. The classs behavior is defined by the class and is shared by all instances.
Question:- Which of the following statement is true in the case of the property of the JSON() method? a. A JSON() method can be invoked manually as object.JSON() b. A JSON() method is invoked automatically by the JSON.stringify() method c. A JSON() method is automatically invoked by the compiler. d. A JSON() method cannot be invoked in any form.
Answer:- B is the correct option. The JSON() method is most commonly used to exchange data to/from a web server. When we send data to a web server, the data has to be a string. In this case, json.strigify() is used to convert a JavaScript object into a string.
