What is the difference between return and return()?

The same as between

var i = 1 + 1;

and

var i = (1 + 1);

That is, nothing. The parentheses are allowed because they are allowed in any expression to influence evaluation order, but in your examples they’re just superfluous.

return is not a function, but a statement. It is syntactically similar to other simple control flow statements like break and continue that don’t use parentheses either.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)