JavaScript Basics 1

Source: Internet
Author: User

1. Data type: null and undefined differences?

Undefined refers to a primitive type that has no definition, and Null refers to an object that is not defined.

2. Array declaration: [' A ', 3, ' Hello ', true];

3. Control structure: for (var i=0; i<test.length; i++) {//...}

If object: var obj = {name: ' AA ', age:23};

For (var k in obj) {console.log (k+obj[k]);}

4. Object manipulation:

Str.length; STR.SUBSTR (2,3);

var aa =[' A ', ' B ', ' C ', ' d '];

var bb = ' a,b,c,d,e ';

object is merged into a string: Aa.join (', ');

The string is decomposed into objects: bb.split (', ');

Returns the location where the string appears: IndexOf (String);

Tolowercase//touppercase//replace (STR1,STR2);

  Date object:

getFullYear ();//

GetMonth ()//

GetDate ();

GetHours ();

Getminutes ();

Getseconds ();

Getmilliseconds ();

  Math Mathematical object:

  Ceil (..); >= the smallest integer of this number.

Floor (..) <= the largest integer of this number

Min (d1,d2,d3); Returns the minimum value

Max (D1,D2,D3);

Random ();

  

JavaScript Basics 1

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.