10th October 2022

Quick Tip : How to Use the Spread Operator in JavaScript

Symbolized by three dots (...), the JavaScript spread operator was introduced in ES6. It can be used to expand elements in collections and arrays into single, individual elements The spread operator can be used to create and clone arrays and objects, pass arrays as function parameters, remove duplicates from arrays, and more Syntax The spread operator can only be used on iterable objects. It must be used right before the iterable object, without any separation. For example: Function Parameters Take as an example the Math.min() method. This method accepts at least one number as a parameter and returns the smallest […]