JS Basics Review: Where JavaScript is written

Source: Internet
Author: User

Love to create Classroom JS Basic review: JavaScript writing position

Review

JS Writing Position:

The bottom of the body tag.

The actual work is written in a pair of script tags within the head tag.

Alert () Pop-up box.

Console.log ()

Literal:

Numeric literals: integers, floating-point numbers, special characters (Infinity,nan).

String literals: All languages, numbers in a language, special strings.

Variable:

Defining variables

Rules for identifiers: The first character is a letter (a-z,a-z), an underscore, a $. Other characters can be letters (A-Z,A-Z), underscores, $, numbers. (You cannot use the keyword specified in js, reserved words).

1 var A;


Variable assignment: The right value is assigned to the left.

1 A = 10;


Usually we write variable declarations and assignments together:

1 var a = 10;


Variable declaration elevation: Only the declaration is lifted, and the assignment of the variable is not promoted.

Data type: typeof ()

Number: Numeric type. integers, floating-point numbers, special characters.

String: Type.

The undefined:undefined type. Represents undefined. Oneself is a type.

Boolean: Boolean type. True,false.

Null: You are also a type.

The number type is converted to a string: number + "";

1 Console.log (12 + "3"); 123


The string type is converted to a number:

parseint (): Converted to an integer.

1 Console.log (parseint ("12.234 Hello World. 233")); 12


Parsefloat (): Converts a string to a floating-point number.

1 Console.log (parsefloat ("78.2341e3.7898 World")); 78234.1
This article copyright belongs to love to create class all, reproduced please indicate the source.

For more details, please visit the homepage of the AI Chong class website .

http://www.icketang.com/

JS Basics Review: Where JavaScript is written

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.