JavaScript Knowledge Summary < one >

Source: Internet
Author: User

JavaScript Core Base syntax:

1. What is JavaScript?

We know that the Web page consists of three parts: structure, form and behavior, and the structure is made up of standard XHTML, formal and standard CSS, then the behavior is represented by JavaScript, which is the standard language of behavior.

So we probably know what JavaScript is for--it's a programming language designed to add interactivity to a Web page, and its code is usually embedded in a Web page. Although it is not much different from the Java name, in fact, they have no relationship between the two languages, knowledge borrowed from the Java name to attract the degree. It is an explanatory language, meaning that it does not need to be pre-compiled to execute, is a scripting language, usually only through a Web browser for interpretation and execution, so JavaScript can only be confined to the browser environment. JavaScript is designed to increase usability for the Web site, not to disrupt the privacy and security of users, so JavaScript does not allow users to read and write files, take the same-origin policy, and allow only interactions from the same domain.

What can 2.JavaScript do?

    1. Gives programmers the ability to fully control all elements of an HTML Web page, a scripting language designed to be used to program Web pages.
    2. You can put dynamic text in an HTML page.
    3. Responds to events that occur when a user uses a Web page.
    4. Used to validate data entered by the user.
    5. Detects the visitor's browser.
    6. Used to create cookies.

3.JavaScript Core Technology System:

    1. JavaScript core language definitions: data types, variables, constants, operators, statements, and so on.
    2. Native objects and built-in objects: a specific program written for Java-like core class libraries for easy development.
    3. Browser object Model BOM: Because the Web page is embedded in the browser to run, we sometimes need to control the browser's navigation bar, browser window and so on.
    4. Document Object Model DOM: In order to control all elements on a Web page through a program, you can modify the Web page dynamically. Provides a series of specific programs that control all elements of a Web page document-the Document Object model DOM, which is the core technology of JavaScript learning.
    5. Event-handling model: In response to Web page events, JavaScript defines some mechanism for handling Web page events. This mechanism allows us to bind the JavaScript code we have written to handle events in JavaScript script code with specific page events to implement the corresponding JavaScript code when the page event is triggered.

4. Add JavaScript to the XHTML document:

    1. Embed JavaScript statements directly in the XHTML document using the SCRIPT element.
    2. Link the JavaScript source file to the XHTML document through the SRC attribute of the <script> element.
    3. The script is included in the XHTML event handler properties, for example: OnClick.

5.JavaScript variables:

The variables in JavaScript are defined with the var operator plus the variable name. Unlike Java, because JavaScript is weakly typed, you do not need to explicitly declare a data type when defining a variable, and the variable is not necessarily initialized.

6.JavaScript data type: This is similar to Java, which can be stored in two languages, one for the original data type and the other for reference data types.

    1. Raw data type:

      That is, there are 5 raw data types, undefined, null, Boolean, number, string.
      The typeof operator is provided in JavaScript to check the type or value of a variable. The way to use it is: TypeOf value/variable.
      Data type conversion, the ToString () method turns into a string, and all is available. The method of turning into numbers parseint (), parsefloat (), turns into integral and floating-point types. There are number strong turn mode, turn into numbers or Nan non-numbers.

    2. Reference data type:

      Native objects, which are objects that are provided by JavaScript that are independent of the hosting environment (ie, the browser), are simply the objects defined in the ECMA-262 standard. Includes: Object, Function, Array, String, Boolean, number, Date, REGEXP, Error, Evalerror, Rangeerror, Referencerrror, SyntaxError, TypeError, Urierror.
      The built-in object, like the native object definition, is actually one of the native objects, except that the built-in object does not need to be initialized because it is initialized. Two built-in objects are defined in ECMA-262: Global, Math.


7. Functions:

A function is a set of statements that run anywhere, at the core of JavaScript, and functions are by keyword function. The function name plus a set of parameters and the code declaration to execute in parentheses. The basic syntax for a function is as follows:

Function name (parameter 1, Parameter 2, ...., parameter n) {statement}

Note that the function here is different from the Java function method, that he does not need to return a value that is natural void, and does not have to declare it, the function only needs the return operator followed by the value to be returned. Of course, the sentence can also add a lot of conditional judgment statements or business logic inside, like Java. It should be noted that if the function has no definite return value, or if a return statement with no arguments is called, then its true return value is undefined.

JavaScript, a scripting language used to enhance web interaction, is popular and is now more developed than language, so programmers must master and use it flexibly. In terms of data types should be more different and memory, in the interview will be the interviewer asked questions, don't always say just define VAR can be. It seems that you just don't understand the language. Built-in objects and native objects these classes must be memory-mastering. Often used in development.

Today is the fourth day to enter the company, a lot of harvest, of course, the challenge is also very big. Because the development experience is not enough, there are too few things to be seen. It is not easy to fully understand this already formed project, in July to release the new version, everyone is very busy working very seriously. I also just changed and confirmed some bug work, contribution is not very big, did not help the project group of Busy, in the mind is also very anxious. No matter what, difficult or easy, all should calm down, practical and serious treatment, serious work. Know where you are not enough, and then actively face, will be insufficient to fill up slowly. Strive for early integration into the project and make some contribution to the project team. I believe I can do it!!!

JavaScript Knowledge Summary < one >

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.