2015-09-28 Meet JS1

Source: Internet
Author: User

Javascript

I. Features

1. Case-sensitive

2. Weakly typed variable, only with the keyword "var"

3. Note/*....*/

Two. Variables

1. The variable is declared by the keyword var.

2.var can declare multiple variables at the same time. -------var girl= "jsaacom", Age=19,male=false;

3. Variables are not necessarily initialized. ---------var people;

Three. Variable name rules

1. The initial letter must be (letter, underscore, or dollar symbol)

2. The remaining letters can be underscores, dollar characters, any letters or numbers

3. Variable name does not contain keywords

4. Naming habits

Type Prefix Example
Array A Aarray
Boolean B Bmale
Floating point F FTax
Function Fn Fnswap
Integral type I Iage
Object O Ocar
Regular Re Repattern
String S Suniversity

Four. Data type

1.length----Get string length

2.charAt----Gets the character at the specified position

3.substring----intercepts the character, which does not include the character that terminates the position, and the second parameter defaults from the start position to the end of the string.

4.SUBSTR----intercept n lengths from the starting position

5.indexOf----Gets the position of the first occurrence of a character, if there is a second argument s, indicating the first occurrence of this character from S

6.lastindexof-----Ibid, the difference lies in looking forward from behind.

7.PARSEINT----string Conversion integer (parsefloat decimal type)

8.Number-----String Conversion Array (numeric type string into numeric value)

if (IsNaN (nnum)) {alert ("not a numeric type string");} Else {alert ("is a numeric type string");}

Note: Isnan=is not number

Five. Arrays

1. Writing style (3)

var ateam=new Array (12)----

var acolor=new Array (); ----Indeterminate array length

var ateam=[10,20,30];---length is 3

2.toString----converted to a string, separated by "," by default

Alert (Ateam.join ("-"). ToString ());

Note: Separate by other means (underline)

3. String variable group--->split (requires the same connector) such as: Var sstring= "AAA_BBB_CCC"

4. Reverse order---->reverse

5. Sort---->sort (English only)

2015-09-28 Meet JS1

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.