OVERVIEW
The Spread operator is a little-known operator which allows you to join arrays together. This might sound similar to the join() function but the difference is that the join() function returns the array as a string, whereas the spread operator returns it as an array.
The spread operator is represented by three dots …
The sample code below shows it in action
SAMPLE CODE
<html>
<head><title>Spread Operator</title></head>
<script>
let arr1 = [1,2,3];
let arr2 = [4.5,6.09,10.001];
var arr3 = ["one", "two", "three"];
let arr4 = [...arr1, ...arr2, ...arr3];
document.write(arr4);
</script>
<body>
</body>
</html>
The output is shown below
1,2,3,4.5,6.09,10.001,one,two,three
Leave a Reply