JS Basic knowledge 1

Source: Internet
Author: User

1. What is JavaScript?

is an object-based client-side scripting language used to interact with Web pages

2. Web Page Three layer structure

Behavior layer of structural layer expression layer

3, the composition of JavaScript

ECMAScript (European Association of Computer manufacturers, not a language, but an organization, used to standardize the grammar standards of JavaScript)

BOM (Browser object model)

DOM (Document Object model)

4. JavaScript implementation

Using the script tag to implement

Implemented by external introduction

5. JavaScript Output statements

Alert () Console.log () document.write ()

6, JS in the output of the results to pay attention to several issues

A: If the output is a character, the character must be enclosed in quotation marks.

B: If the output is a variable value, the variable must not be enclosed in quotation marks.

C: If both the output character and the output variable, between the character and the variable with + represents the connection

D: If the output is a numeric value, the array can be enclosed in quotation marks.

7. Basic data type

Number string Boolean object undefined null function

typeof return value has: Number string Boolean object undefined function

8. Forced type Conversion

parseint () parsefloat () number () toString ([parameter])

Eval () (converts a string to an expression and outputs the value of an expression)

IsNaN () determines non-numeric, if the parentheses are non-numeric, the value is true otherwise false

9, the three main structure of the program

Sequential selection Loops

10, JS in the Boolean environment, the following represent true and false two kinds of situations

A: All numbers are true, 0 is False

B: All strings are true, empty strings are false

C:null and undefined are false.

D: All objects are true

11. Multi-branch switch and if usage scenarios

When the general condition is a range, you can use the IF

When the general condition is a specific value, using switch can improve efficiency

12. For and while usage scenarios

When defining the number of cycles, it is recommended to use the for

It is recommended to use While/do...while when the number of cycles is unclear

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