When you want to store multiple values in a single variable, you should use a(n) _________.

  • "array"
  • "object"
  • "string"
  • "function"
To store multiple values in a single variable in JavaScript, you should use an array. An array is a data structure that can hold multiple values of different data types. It is created using square brackets, like this: var myArray = [value1, value2, value3];. Arrays are versatile and commonly used for tasks like storing lists of items or organizing data.

Which property allows you to change the HTML content of an element?

  • textContent
  • innerText
  • innerHTML
  • innerTextContent
The innerHTML property allows you to change the HTML content of an element in JavaScript. It is often used to set or modify the content of an element and can include HTML tags. However, be cautious when using innerHTML to avoid potential security issues, such as cross-site scripting (XSS).

If you want to convert a JavaScript object to a string in the Fetch API, you should use the _________ method.

  • parse()
  • serialize()
  • stringify()
  • convert()
In the Fetch API, you should use the JSON.stringify() method to convert a JavaScript object to a string. This method serializes the object into a JSON string, which is a common way to send structured data in HTTP requests and responses. parse() is used for JSON parsing.

The ________ interface provides methods to deal with HTTP responses represented in binary format.

  • a) TextDecoder Interface
  • b) FormData Interface
  • c) Blob Interface
  • d) ArrayBuffer Interface
The Blob interface provides methods to deal with HTTP responses represented in binary format. It allows you to work with binary data such as images, audio, or other binary content in a more efficient way. This is essential when handling binary data in web applications.

You're debugging a piece of code and find an unexpected type coercion in a comparison. Which operator is most likely being used that could cause this issue?

  • == (Equality)
  • === (Strict Equality)
  • > (Greater Than)
  • != (Inequality)
The double equal operator (==) performs type coercion during comparison, which means it converts the operands to the same type before comparing. This can lead to unexpected results when comparing values of different types, potentially causing type coercion issues in your code. You should generally prefer strict equality (===) to avoid type coercion.

How does the temporal dead zone impact function expressions in JavaScript?

  • It prevents the use of arrow functions in function expressions.
  • It enforces a delay in the execution of function expressions.
  • It causes a runtime error if a variable is accessed before its declaration in a function.
  • It makes function expressions execute before other code in the same scope.
The temporal dead zone (TDZ) is a phase during the variable initialization in JavaScript. It occurs between the variable's declaration and its assignment. During this phase, trying to access the variable will result in a ReferenceError. This impacts function expressions as variables declared within them are also subject to the TDZ. If you try to access such a variable before its declaration, it will lead to a runtime error.

Which method is commonly used to iterate through elements of an array in JavaScript?

  • for...in loop
  • forEach() method
  • while loop
  • map() method
The forEach() method is commonly used to iterate through elements of an array in JavaScript. It allows you to execute a provided function once for each array element, making it a straightforward choice for looping through arrays. The other options, such as for...in loop, while loop, and map() method, have different use cases and are not the most common choices for simple array iteration.

How can you handle errors with Fetch API in a way that also catches HTTP error statuses?

  • Using try...catch blocks
  • Checking the status property
  • Using the .then() method
  • Using the .error() method
You can handle errors with Fetch API by using try...catch blocks. While the Fetch API does not throw exceptions for HTTP error statuses (e.g., 404 or 500), it does throw exceptions for network errors (e.g., no internet connection). By wrapping your Fetch code in a try...catch block, you can catch both types of errors and handle them appropriately, ensuring a robust error-handling mechanism.

The shift() method will return _______ when it is used on an empty array.

  • undefined
  • NaN
  • 0
  • FALSE
The shift() method removes and returns the first element from an array. When used on an empty array, it returns undefined because there are no elements to remove. This behavior allows you to check if an array is empty by evaluating the result of shift().

_________ is the organization that now oversees the ECMAScript specification, which serves as the basis for JavaScript.

  • W3C
  • Mozilla
  • ECMA International
  • ISO
ECMA International is the organization that now oversees the ECMAScript specification, which serves as the basis for JavaScript. ECMAScript is the standardized version of JavaScript that various browsers implement.