Declaring variables :
var= Let defines a variable, which can be used to declare a local variable of a block scope (block scope local variable).
Declaring Constants :
keyword is CONST Syntax: const = 1.1313131, usually in theform of full capitalization of names, whose values are immutable and must be assigned when defined.
Note: Variables defined with let or const do not have a "variable boost" and a "reference error" occurs if a variable is used before it is defined.
2 types of functions :
function GetName () {Execute code block;}
Note: Functions can have parameters or return values, or they can be taken without. If you have parameters, you need to add the corresponding parameters when calling the function. If there is a return value, you should provide a container (such as a variable) to receive the return value when the function is called.
Two: Function expressions (also called anonymous functions, popularly called functions without names) syntax: var function () {Execute code block;}
Note: In the above example, fun is the variable name, also the function name, when using fun equivalent to get the entire function body, when using fun () equivalent to call this function.
var function () {Console.log (111);} Fun ();
--"111
var bb = fun;console.log (BB);
--》
Note: function promotion, only the declarative (named) function can be promoted, the expression (anonymous) function is not promoted.
JavaScript variables, constants, function declarations