Imagine you're reading a book about the history of web development. The chapter on JavaScript mentions a language that was developed almost simultaneously and competed with JavaScript in the early days. What is the name of this language?

  • LiveScript
  • CoffeeScript
  • TypeScript
  • ActionScript
In the early days of web development, there was another language called "LiveScript" that was developed almost simultaneously with JavaScript. Although they had similar names, they were different languages. Eventually, LiveScript was renamed to JavaScript.

The mechanism that allows you to use the structure of a class and alter it for use in another class is known as _________.

  • Inheritance
  • Polymorphism
  • Encapsulation
  • Abstraction
The mechanism that allows you to use the structure of a class and alter it for use in another class is known as "Inheritance." Inheritance in JavaScript is achieved through the prototype chain, where a child class can inherit properties and methods from a parent class, allowing for code reuse and extension.

What does the keyword "new" do in JavaScript?

  • Creates a class
  • Declares a variable
  • Instantiates an object
  • Defines a function
The keyword "new" in JavaScript is used to instantiate an object from a class constructor. When you use "new" followed by a class constructor, it creates a new instance of that class, allowing you to work with objects that have the properties and methods defined in the class. It doesn't create a class, declare a variable, or define a function.

An async function can contain an await expression that pauses the execution of the async function and waits for the passed _______ to resolve or reject.

  • callback
  • timeout
  • Promise
  • generator
An async function can contain an await expression that pauses the execution of the async function and waits for the passed Promise to resolve or reject. This allows for more readable and sequential asynchronous code, making it easier to work with asynchronous operations.

You are reviewing a junior developer's code and see the following line var x = 10;. You want to advise them to use a declaration that maintains block scope, which keyword should they use instead of var?

  • let
  • const
  • block
  • scope
Instead of var, they should use let to maintain block scope. var has function scope and can lead to unexpected behavior in certain situations, while let declares a variable with block scope, ensuring that it's limited to the block in which it's defined.

What does the async keyword do in front of a function in JavaScript?

  • Marks the function as asynchronous
  • Declares a synchronous function
  • Makes the function execute faster
  • Signals the end of a function call
Adding the async keyword before a function declaration in JavaScript signifies that the function is asynchronous. This means it can use the await keyword inside to pause execution until asynchronous operations within the function are complete, improving code readability and maintainability.

The ________ initiative aimed to standardize the core features of JavaScript.

  • ECMAScript
  • JavaScriptCore
  • JSStandard
  • WebScript
The ECMAScript initiative aimed to standardize the core features of JavaScript. ECMAScript defines the language specification that JavaScript implementations, such as those in web browsers, must adhere to. It ensures consistency and compatibility across different environments.

Which technology was NOT directly influenced by JavaScript's development?

  • JSON (JavaScript Object Notation)
  • Java
  • Node.js
  • jQuery
While JavaScript and JSON share a similar name, JSON (JavaScript Object Notation) is a data interchange format and not a technology directly influenced by JavaScript's development. Java, Node.js, and jQuery, on the other hand, are technologies that were influenced or built upon JavaScript.

How to declare a block-scoped variable in JavaScript?

  • var keyword
  • const keyword
  • let keyword
  • block keyword
In JavaScript, you can declare a block-scoped variable using the let keyword. Variables declared with let are limited in scope to the block, statement, or expression in which they are defined. This helps prevent unintended variable hoisting and allows you to create variables with localized scope within functions or blocks. var is function-scoped, and const is used to declare constants. block is not a valid keyword for variable declaration.

The querySelector method uses _______ selectors to select elements.

  • CSS
  • XPath
  • JSON
  • HTML
The querySelector method uses CSS selectors to select elements in the DOM. You can use CSS selector syntax to specify the elements you want to select, making it a powerful tool for finding and manipulating DOM elements based on their attributes and structure.