When do we need ()?


Does anyone know when do we need ()?
When we use return, we do not need it. and when we use console.log, we need it. And there are other cases where we need it and where we don’t need it. I’m confuse is there a reason behind it or do we just memorize them.



return is a statement, as explained here:

statements don’t need parentheses, we can add the parentheses which quit uncommon, unless you want to put the code on multiply lines, then adding parentheses is needed

console.log() is a function call, calling a function always requires parentheses


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.