1. The reputation of variables
Window.name = ' Gjlin '; Global Variables Direct name = ' Gjlin ' also represents global variables, but it is recommended to use Window.name = ' Gjlin ' as a form of representation
var name = ' Gjlin '; Local variable var name = ' Gjlin ' In this form, be sure to record the preceding plus var.
2, JS's comment line:///MultiRow:/* content */
3. Definition and execution of functions
Name = ' 123 '
Foo ()//Execute function
Bar ()//Execute function
function definition
function Foo () {
var name = ' Gjlin ';
Window.name = ' Gjlin '
var name = ' Gjlin ';
var agr2 = arguments[1];
Print console logs can be used in the browser for debugging
Console.log (name);
Console.log (ARG2);
The representation of the return value
return name;
}
function Bar () {
Console.log (name);
Alert (name)
}
JavaScript basics variables and function declarations