โ† All Web Development Flashcard Decks

JavaScript Flashcards

7 cards from real Web Development practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 JavaScript flashcards as text
  1. What does the `async` keyword do when placed before a function declaration?

    Answer: Both B and C

    An `async` function always returns a Promise and enables the use of `await` inside it to pause execution until a Promise settles.

  2. What is the correct way to clone an object shallowly in modern JavaScript?

    Answer: Object.assign({}, obj)

    `Object.assign({}, obj)` copies all enumerable own properties from `obj` into a new object, creating a shallow clone.

  3. What is 'hoisting' in JavaScript?

    Answer: The behavior where variable and function declarations are moved to the top of their scope before execution

    JavaScript hoisting moves declarations (not initializations) to the top of their scope during compilation, so functions and `var` declarations are available before their line in code.

  4. What does `Symbol()` create in JavaScript?

    Answer: A unique and immutable primitive value used as object property keys

    `Symbol()` creates a unique primitive that is guaranteed to be distinct from all other values, even other Symbols created with the same description.

  5. Which of the following correctly uses optional chaining (`?.`)?

    Answer: user?.name ?? 'Guest'

    `user?.name` safely accesses `name` on `user`, returning `undefined` instead of throwing if `user` is `null` or `undefined`.

  6. What is the purpose of `Object.keys()` in JavaScript?

    Answer: Returns an array of an object's own enumerable string-keyed property names

    `Object.keys()` returns an array of the object's own enumerable property names, excluding inherited or Symbol-keyed properties.

  7. In JavaScript, what is the 'event loop' responsible for?

    Answer: Managing the order in which tasks and microtasks are executed in the single-threaded runtime

    The event loop continuously checks the call stack and task/microtask queues, executing queued callbacks when the stack is empty to enable non-blocking async behavior.

How this page was made: written with AI tools. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Not reviewed by a subject-matter expert. Editorial policy