I'm learning about the javascript basics. The two lines of code seem equivalent and I'm wondering if the parser simply ignores the parentheses in the second case:
var a = 5 + 5;
var b = (5 + 5);
EDIT: I realize the context of the question might of help after going through the comments, which are helpful. I was trying to assign some JSX to a variable and noticed that the parentheses seem optional:
var a =
<div>
<SomeComponent />
</div>;
var b = (
<div>
<SomeComponent />
</div>
);
In the case of a return statement, I understand that parentheses are needed due to automatic semicolon injection. But in case of a simple assignment do the parentheses still matter?
EDIT 2: Thanks for the comments and answer that help me narrow down and articulate my question. I think what I really meant to ask is, does JSX parser (e.g. Babel) ignore the parentheses in such a case? Since both will be transpiled into:
var a = React.createElement(
"div",
null,
React.createElement(
SomeComponent,
null
)
)