In many situations, we get an array holding a lot of elements. Sometimes we need to work with those array elements.
Now we are going to print it as comma separated string.
It will give you the desired result.
.toString() actually calls the .join() so it will join the elements with commas.
So you can also use the below:
here the output will be like this:
So, this is the same as the previous one. But you can add something after comma here. Or you can add a space by just doing the following: