W3Teacher
  • Explore
    Browse by field
    Artificial Intelligence Accounting & Finance Information Technology
    Show all fields
  • Interview Q&A
    • All Interview Questions
    • Beginner
    • Intermediate
    • Advanced
  • Practice
    • MCQs
    • Quizzes
    • Mock Interviews
  • About
  • Sign in
  • Get Started
  1. Home
  2. Search: Destructuring
  3. JavaScript
  4. Destructuring, Spread & Rest
  5. Question
All 10 Destructuring, Spread & Rest questions
More in Destructuring, Spread & Rest
How do you destructure values out of an array? How do you destructure properties out of an object? How do you assign default values while destructuring? How does the rest parameter differ from the spread operator, even though they use the same '...' syntax? How do you use spread to shallow-copy and merge objects? How do you destructure nested objects and arrays in one statement? Why must the rest element be the LAST element in a destructuring pattern? How can you use destructuring to swap two variables without a temporary variable? How do computed property names interact with object destructuring?
Advertisement
Back to results for “Destructuring”
JavaScript › Destructuring, Spread & Rest

What does the spread operator (...) do when used on an array?

Beginner

Answer

Spread expands an iterable's elements in place, commonly used to copy an array or merge multiple arrays into a new one without mutating the originals.
const a = [1, 2];
const b = [3, 4];
const combined = [...a, ...b]; // [1, 2, 3, 4]
Real-world example Merging a default list of settings with user-provided overrides.

Common follow-ups: Does spreading an array create a deep copy or a shallow copy?

Arrays & Array Methods
Previous question How do you destructure properties out of an object? Next question How do you assign default values while destructuring?
All 10 Destructuring, Spread & Rest questions
W3Teacher

Learn technologies. Ace technical interviews.


    Learn
    • Technologies
    • Tutorials
    • Interview Questions
    • MCQs
    Practice
    • Quizzes
    • Mock Interviews
    • Bookmarks
    • Dashboard
    Get the latest questions & tips

    Fresh interview questions and practice tips, straight to your inbox.

    Company
    • About
    • Contact us
    • Privacy Policy
    • Terms & Conditions

    © 2026 W3Teacher. All rights reserved.