What is spread Operator (...) in JavaScript?

JavascriptWeb DevelopmentFront End Technology

With Spread Operator, allow the expression to expand to multiple arguments, elements, variables, etc.


You can try to run the following code to learn how to work with spread operator −

         var a, b, c,d, e, f, g;  
         a = [10,20];
         b = "rank";
         c = [30,"points"];  
         d = "run"
         // concat method.  
         e = a.concat(b, c, d);  

         // spread operator  
         f = [...a,b, ...c, d];  
Published on 19-Jan-2018 05:57:33