In functional composition, the output of function ______ becomes the input of function ______.

  • Output, Input, Result, Transformation
  • Transformation, Input, Output, Composition
  • Result, Transformation, Input, Output
  • Composition, Result, Output, Input
In functional composition, the output of one function serves as the input for the next one. This is a key concept in functional programming, where functions are chained together to perform a series of transformations on data.

Consider a library with multiple utility functions; how would you structure the exports to optimize for tree shaking?

  • export function util1() {} export function util2() {}
  • export { util1, util2 }
  • export default { util1, util2 }
  • export const util1 = () => {}; export const util2 = () => {};
To optimize for tree shaking, individually exporting functions (export function util1() {}) allows dead code elimination, ensuring only the used functions are included in the final bundle.

In object methods, using arrow functions can lead to issues when relying on the this keyword, as it does not bind its own this, but inherits it from the ________ scope.

  • Parent
  • Global
  • Lexical
  • Block
Arrow functions inherit the this value from their lexical scope, which means the scope in which they were defined. This can lead to unexpected behavior when used in object methods.

In Node.js, ES6 Modules have a different file extension (_________) compared to CommonJS modules (.js).

  • .mjs
  • .es6
  • .es
  • .node
Node.js uses the .mjs file extension for ES6 modules to differentiate them from CommonJS modules that typically use the .js extension. This helps Node.js to identify the module type and apply the appropriate module loading mechanism.

Can a static method in a parent class be overridden in a child class?

  • Yes
  • No
  • Depends on the method implementation
  • Only if explicitly declared as override
Yes, a static method in a parent class can be overridden in a child class. However, it's important to note that static methods are associated with the class itself rather than instances, and the child class can provide its own implementation of the static method, effectively overriding the one in the parent class.

Can default parameters be expressions or function calls?

  • No, only primitive values are allowed
  • Yes, any valid expression or function call is allowed
  • Only function calls are allowed
  • Only arrow function expressions are allowed
Yes, default parameters in ES6 can be expressions or function calls. This enables dynamic default values based on the evaluation of expressions or the result of function calls. It provides flexibility and allows for more sophisticated default values in function parameters.

Composition in ES6 involves creating objects by combining multiple __________ that provide functionality.

  • Promises
  • Objects
  • Prototypes
  • Modules
Composition in ES6 involves creating objects by combining multiple objects that provide functionality. This promotes a modular and reusable code structure by assembling smaller pieces to form more complex objects.

In ES6, how does the shorthand for method properties affect the 'function' keyword in object literals?

  • It removes the need for the 'function' keyword.
  • It enforces the use of the 'function' keyword.
  • It modifies the behavior of the 'function' keyword.
  • It's not related to the 'function' keyword.
In ES6, the shorthand for method properties allows omitting the 'function' keyword when defining methods in object literals. It enhances code readability by providing a more concise syntax for method definitions within objects. This syntactic sugar simplifies the declaration of methods in objects, making the code cleaner and more modern.

The concept of ________ is essential in understanding how functions are combined in functional composition.

  • Closure
  • Immutability
  • Prototypes
  • Referential transparency
The concept of referential transparency is essential in understanding how functions are combined in functional composition. Referential transparency means that a function, given the same inputs, will always return the same output, allowing for easier reasoning about the behavior of composed functions.

The spread operator can be used in ES6 to clone an array without ________ the original array.

  • Modifying
  • Changing
  • Altering
  • Mutating
The spread operator can be used to clone an array without mutating the original array. It creates a shallow copy, meaning nested objects are still references, but the outer array is a new instance.