PHP Learning Day06 notes (first knowledge JS)

Source: Internet
Author: User

· JS full-name JavaScript, is a Web page in the use of scripting language, JS is very powerful, you can implement various functions and special effects of HTML pages.

· JS Annotation method: Similar to other languages, JS in the annotation method is

• Single-line comment//xxxxx ...

• Multi-line Comment/*xxxxxxxx

xxxxxxxx*/

· The output syntax of JS:

alert ("Information that needs to be output, which can be a function or an expression"); Pop-up box display information content

confirm ("need to output de information"); The popup dialog (user interaction type) can be submitted via the Confirm and cancel button.

prompt ("user input information"); POPs up a dialog box that allows the user to enter

• Embed JS location: generally written at the bottom of the page content or the bottom of the body, because the page loading content order is from top to bottom.

Embedded format is <script type= "Text/javascript" > Content </script>

· JS basic knowledge of the program

• All characters are in English state, such as common semicolons, commas, and parentheses.

• In most cases, the end of each statement should be preceded by a semicolon;

• Line breaks after each piece of code ends

• The symbols for each program statement should be echoed back and forth.

· JS data type

• The stored name of the data in the program is called a variable, and the method of declaring the variable is the var variable name

Because JS is a weakly typed language, variable data types are not differentiated when declaring variables, but are automatically converted when stored

JS data types include int (integer type), float (single-precision decimal type), double (double-precision decimal)

Decimal (decimal), Money (currency type), char (character type) string (String type)

Boolean (Boolean: Return value only True and False) DateTime (date type)

• Forced conversion of data types =parse variable type (variable) of forced conversion; For example, Var x=parseint (x) is the conversion of X to integer type;

• Operator Expression: +-*/for subtraction,% for remainder (e.g. 5&2=1)

• Logical operators: && (and): Both are true and the result is true;

|| (OR): As long as one of them is true, the result is true;

! (non): reverse the result.

• comparison operator: = = (equals);! = (not equal to);> (greater than);< (less than); >= (greater than or equal to);

<= (less than or equal)

+ You can stitch strings;

A ==b? X:y (indicates selection judgment, output x If the result is true, output y if the result is false)

    

PHP Learning Day06 notes (first knowledge JS)

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.