why we use a spread operator?

Shorthand answer: Create a new array with the existing array.

In this topic, I try to explain shortly about the spread operator clearly. Suppose we have two arrays. The first array has some content and the second array have some content. If we concatenate the two array in a third new array and console the third array, in that time we lock only concern that we get the 3rd array is a nested array but our demand is not fulfilled and we want a single array this is concatenated with two arrays but our expectation is fake so that we cannot get a single array. so about this problem we can use spread operator please see the example and I think you will be clear about it.



Abdul Hay

My real-world name is Abdul Hay and I’m from Bangladesh. At this moment I’m working as full-stack web developer at lovely company.