js introductory basics (1)

Basic knowledge

What is js special effect: ( js function is usually placed after body )

    1. Define events (define timing + behavior)

    2. Trigger timing (execute the behavior (behavior occurs))

    The occurrence of events is repetitive (unless controlled by humans)


Components of an object:

      1. Attributes (features)

       2. Method (behavior)

JavaScript is an object-oriented programming (js is an object-based language):

    1. How to get the object

    2. How to call the properties of the object

    3. How to call the method of the object

The location where js is placed (execution order):

    1. Inline

    2. Internal

    3. External

How does js define variables    

Define variables: var name= 'Xiao Ming';

output variable: 

    alert(name); //pop up

    document.write(name);  //输出

js link symbol: +

js comments:  

    1. Single line comment //   

    2. Multi-line comments /* */

    

js variable type

    1. String var name = 'kitonGao';

    2. Integer var i = 5;

    3. floating point var i = 100.1;

    4. Boolean  

    5. Array var arr = new Array(); // Use a separate variable name to store a series of values

    6. Objects  

         js object:

                 var obj = new Object() ;

                 obj.name = 'kitonGao' ;

                 obj.age = 24;

        dom object:

                var obj = document.getElementById('xx');

    7. json object

            var user = {'name':'kiton', 'age':24};

    8.NaN:  A special value representing a non-numeric value. This property is used to indicate that a value is not a number.

    9.null

    10.undefined





Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325565197&siteId=291194637