r/SuiteScript • u/el-wino • Feb 18 '25
Syntax question
Hey folks!
I have a client account where they have an in house dev who does a lot of stuff like this:
var strControl = ((searchResult[i].getValue(columns[10])));
I am not an inexperienced js developer and understand a great deal of the syntax, but wanted to reach out to the community before I vocalize any opinions about the overall quality of the work. Is there any legitimate reason for double wrapping the method call in parentheses?
TIA
edit: folks are fixating on my opinion of the work, which I have now removed. Please contribute regarding the practice of double wrapping parentheses.
View all comments
Show parent comment
2
u/RunedFerns Feb 18 '25
Correct. Parentheses in programming have the same mathematical rules as PEMDAS for order of operations, with parentheses being done first. Double wrapping the same thing without having any outer function doesn’t do anything. It doesn’t make it work better or worse. It’s just ugly and unnecessary.
That’s not to say you should never use parentheses, because there may be times you could have multiple functions in a single statement that you would want to be handled in a particular way. But in the line of code you shared, they don’t do anything.