Introduction to JSP introductory HTML and JavaScript (iii) JavaScript application

Source: Internet
Author: User
Tags define definition

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:

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.