HTML static Web page--javascript-syntax

Source: Internet
Author: User

1. Basic Data type:

String, Decimal, Integer, DateTime, Boolean, and so on.

2. Variables:

are generic type var, can be stored casually other types of values, can be used directly, not defined, but customary definition. Define variables: var A; all variable definitions

are defined with Var, var is a generic mutable type.

3. Type conversion:

  It is divided into automatic conversion and casting, which is generally used for casting.

Other types are converted to integers: parseint ();

Other types convert to decimals: parsefloat ();

Determine if it is a valid number type: IsNaN ();

is a number then returns false, not a number to return ture.

Returns False if the number is entered, otherwise returns ture.

4. Operators:

  Math Operator: +-*/% + +-;

  Relational operators: = =! = >= <= > <;

  Logical operator:&& | | ! ;

  Other operators: + = = *=/=%=? ;

5. Statement:

 It is generally divided into sequential, branching, and cyclic statements.

(1) Branch statement if:

if (judging condition)

{

Statements that meet the criteria to be executed

}

Else

{

Statements executed when a condition is not met

}

(2) Loop for statement:

For ( initial condition; cyclic condition; state change)

{

  Loop body

}

(3) Problem type: exhaustive, iterative.

(4) Two keywords: break and continue.

(5) If you want to output the value of a parameter: the value of the output is "+a+" and "+b"

6. Array:

Definition of the array: new Array (); Its length is dynamically variable and can be placed in any type of element.

Assignment of array elements: a[0]=123; A[1]= "Hello";

Array value: A[i];

Array properties: A.length; The number and length of array elements.

Methods: A.sort (); Arrange the array, sort by the first character, A.reverse (); Flipping an array

7. Function:

Four elements of a function: name, input, return value, processing.

Define functions: Function add (formal parameter) {function body}, function named Add, input as parameter, return value can be var type or return value.

function is not invoked when the function is called: Add (Argument).

HTML static Web page--javascript-syntax

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.