There is a JS problem. I can't figure out why. Looking for answers.

var x = 1;
if (function f(){}) {
    x += typeof f;
}
console.log(x);

"1undefined"
Jan.10,2022

if(/*expression*/)

expression, if (function f () {}) function f () {} in is a function expression with a name , not a function declaration statement

clipboard.png

f

clipboard.png

function f(){}()

clipboard.png

() (),()

clipboard.png

because return is also followed by an expression, function f () {} is considered an expression, so no error is reported when executed directly.

Expressions are also accepted only in

if , so the variable f

is not declared.

to sum up, there are two test points:
1 expression if (/ expression /) receives expressions instead of function declarations.
2, the function name cannot be taken externally in the function expression (because it is optional). The function name is required in the function declaration and optional in the function expression.
so the question just now can't get the f. / p > in if ().

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e503cf-43b74.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e503cf-43b74.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?