JavaScript Summary-What have you given me

Source: Internet
Author: User

a small series of thoughts

JavaScript is finished, but what exactly does it tell me?

first of all, it's a scripting language , and as for what a scripting language is, let's think of it as a programming language to use in a browser. It has its own set of grammars, where there are commonalities with other programming languages, and it has its own characteristics.

So what can it be used for? Everything in the world is not independent , JS is no exception. It realizes the B/s program together with HTML, CSS, ASP, AJAX, jquery and so on, creating a more beautiful world. in this process, HTML is responsible for displaying information, CSS control how to display,JS through the combination of other languages, to achieve specific logic processing.

Because Ajax and jquery these two content, the small part has not learned, so the explanation is not very detailed, hope in the future study, can have a better understanding, so as to share to everyone.

second, the Guide map display

After learning, small in accordance with the individual after the drawing of JS's mind map, not detailed, but the main part should have.


Three, the difficulty analysis1. closed Package

meaning

Closures are blocks of code that can contain variables that are free (not bound to specific objects), that are not defined within this block of code or in any global context, but are defined in the context in which the code block is defined (local variables). Simply put: A child function can use a local variable in the parent function , which is called a closure.

Example (F2 is a closed packet):

Function F1 () {n=999;    function F2 () {alert (n);  } return F2;  } var result=f1 (); Result (); 999

The small part understands that closures are functions that can read other functions ' internal variables . Because in the JavaScript language, only sub-functions inside the function can read local variables, it is possible to simply interpret the closure as " a function defined inside a function ". So, in essence, a closure is a bridge that connects the inside of the function to the outside of the function .

2. null differs from undefined

           null means "No object", that is, there should be no value at all. The typical usage is:
           (1) as a function parameter, The parameter that represents the function is not an object.
           (2) as the end point of the object's prototype chain.

            Undefined means "missing value", that is, there should be a value here, but there is no definition. The typical usage is:
           the (1) variable is declared but not assigned. is equal to undefined.
           (2) When the function is called, the arguments that should be supplied are not provided. This parameter equals undefined.
           (3) The object has no assigned property, and the value of this property is undefined.
           (4) When the function does not return a value, undefined is returned by default.

Small Compilation Understanding: null means that a value is defined, defined as "null"; undefined means there is no definition at all .

3. DOM

JavaScript uses the corresponding built-in object to represent the browser itself, the Web page document, and the HTML elements in the Web page, some of which exist as properties of other objects, and the relationships between objects are called DOM (document OB Ject model) Document object models.

Small Compilation Understanding: Dom is a framework , such as a DOM object in HTML, such as a DOM tree


Dom objects through their own properties and methods can change the HTML elements, attributes, etc., including the control of CSS settings to display the effect.



Related reading: JavaScript tutorials

The difference between undefined and null

Closed Package




JavaScript Summary-What have you given me

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.