JavaScript: define an array differently

I was messing around with Google JavaScript code, and I saw in my code that they define an array in different ways.

What is so unique about writing an array?

var arr = (['b' , 'f' , 's']);

why "(") in this code, it can be both of these:

var arr = ['b' , 'f' , 's'];
  • Does he have a goal?

Thanks in advance.

+5
source share
2 answers

No! It has no purpose in the language and can be safely removed. (This may have something to do with the coding or minimization style.)

+5
source

It is purely stylistic. The brackets do not change the value of the array in any way.

evidence

+1
source

All Articles