Javascript: what is the purpose of wrapping a ternary condition in parentheses?

Viewed 31

I recently came across the following line of code:

var watcherGlobal = (watcherGlobal) ? watcherGlobal : undefined; // crude singleton, todo refactor into function

What I do not understand is why is the condition for this ternary operator wrapped in parentheses? I have seen many ternary operators in code before, but this is the first time that I have seen the condition wrapped like this.

0 Answers
Related