JS Basics 1

Source: Internet
Author: User
Tags naming convention

First, JavaScript
    • Different from Java
    • There are three components
      • Core (ECMAScript)
      • Document Object Model (DOM)
      • Browser object Model (BOM)
var is the prefix that defines the data before adding three, pop-up
    • Alert () Pop-up window, display content
    • Confirm () Displays a dialog box with the specified message (the contents of the confirm) and the OK and Cancel buttons
    • Prompt (text, value);
      • Action: Displays a dialog box to prompt the user for input
      • Text: Display plain text in a dialog box (non-HTML-formatted text)
      • Value: Default input text (can be empty)
Iv. external inductive <script type= "Text/javascript" src= "Xxx.js" ></script> Five for finding data type typeof, throw find Type a below
    • Alert (typeof a);
VI. Basic Types
    • Numeric only if the type is numeric
    • String when double quotes are added
    • True and False for Boolean types
    • Empty type
    • Object: Document
Vii. naming rules
    • Case sensitive
    • The first letter must be a letter, an underscore, or a dollar sign $
    • Cannot contain spaces
    • Cannot use canonical word
    • A naming convention is typically preceded by a type
Eight, arithmetic symbols
    • /division, a decimal point appears
    • + for numeric values are added, for strings are stitching
    • ! It can be used to reverse the judgment condition.
Nine, conditional statement--IF statement
    • If-else statements
    • Other wording: Judging the condition? Expression 1: Expression 2;
      • When the judgment condition is set, the expression 1 is executed, and the expression 2 is executed.
Ten, + + 、--
    • i++ is only added after the call.
    • The ++i is added before the call
XI. format
    • Window.onload = function () {、、、}
      • Function content is not executed until the full page has been scanned
    • When doing projects, it is best to introduce external files behind the body
    • var oshow = document.getElementById ("show"); Get
    • Oshow.onclick = function () {、、、} Click event
12, Continue&&break
    • Continue end Current loop
    • Break ends the entire loop

JS 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.