JavaScript has developed so far, has tended to mature, for JavaScript, a program, must not only contain output operations, but also need to define variables, its application compared to Java is very simple and reasonable.
Defining variables in JavaScript
In the Java language, all variables need to be specified in the definition of the type, but JavaScript does not, all unified use of a var complete, then the specific type of the variable will be given by the content to decide
Since all variables can be declared with Var, there is no difference between writing and not writing. So the above code can completely remove Var.
As with the program, in JavaScript also contains the various control statements, order, branch, loop and so on.
In the previous Java syntax, the emphasis of this = = is not to determine whether the string is equal?
But there is no such limit in JavaScript. (The secondary Union is a contradictory body)
JavaScript definition function
For JavaScript, the definition function is not as troublesome as Java, and all functions are defined with a keyword of function, which can be written directly if there is a return value.
Define a function as follows: