This shows you that in JavaScript, functions are also first-class values. In the add function you have up there, the name of the function: add, is actually a variable that a function definition is stored inside of it. For the second example, mul is not registered as a variable in the scope (list of variables) in the program's memory, rather, what you have there is a function expression, wherein you assign a function definition or say function value to a variable that is x in your case, omitting the mul in that function definition is in fact valid.
The error from calling mul is caused by trying to access mul in the scope (appears to be global) where it is not declared and is neither accessible from other scopes the global scope can access.
Scope (available variables to a program's memory) exists at different levels in JavaScript, two of which are global scope and function scope.
Within the scope of the mul function, mul is accessible there, as well as other variables in a scope that is at a higher level like add (present in global scope) because inner scopes can access outer scopes.
Whereas, mul as well as other variables declared within it cannot be accessible outside of mul's function scope, because outer scope cannot access inner scope.
The inner scopes in your snippet are those of add and mul function scopes, while the outer scope appears to be a global scope.