Skip to main content
InterviewHubPRO
Section Overview
Q193

Question 193 of 536

Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

36%
JavaScript & V8 Internals (536 Qs)•Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

What is a spread operator

junior LevelMost AskedCode ExampleEvent LoopPrototypes

Spread operator allows iterables( arrays / objects / strings ) to be expanded into single arguments/elements. Let's take an example to see this behavior,

javascript
  function calculateSum(x, y, z) {
    return x + y + z;
  }

  const numbers = [1, 2, 3];

  console.log(calculateSum(...numbers)); // 6