Basic JavaScript Learning

Source: Internet
Author: User

Javascirpt It is a basic browser , object-oriented , event-driven Web scripting language developed by Netscape.

JS: object- based, objects include methods and Properties. no direct contact with Java


code writing: outside the chain, embedded, inline (JS code can be written anywhere in the HTML, but the code is run sequentially, usually JS written in bady or)HTML after the Label. Such as: code written in the head , the code cannot read the body Tag)


<scripttype= "text/javascript" >

Writing code

</script>

Format of Comments:

single-line Comments (//) and multiline comments (/* content */)

Declaring variables:

format:

var variable Name = value ;

Variable type:

String: as long as it is quoted characters, they are String, such as:"nihao123"

Number: integer (int) with decimal (float), NaN(it is a numeric type but it is not a count )

Boolean:true/false

Undefined: undefined type, When a variable is declared but not assigned a value .

Null: The value of the null type is only one / or will occur at the time of the Error:

cast:

If you convert a string to a Boolean type : false except "" ("space" This will show True) the others will be True.

numeric data converted to Boolean: 0=== "false 1===" True

Null and undefined will be converted to false

when converting other data types to numeric type: If you can convert it. you'll get a specific number. , but if you can't convert it. you'll Get NaN

As follows:

True 1

False 0

Null 0

Undefined NaN

"numeric character" NaN

"character number" NaN

"number" Digital


Basic JavaScript Learning

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.