Note 003: Basic data types, operators, control statements

Source: Internet
Author: User
Tags arithmetic operators

One, variable

1. Variable name: A combination of letters, numbers, underscores, and dollar signs that cannot begin with a number. is case sensitive.

2, declaring variables: var variable name = variable value;

Second, operator

1, arithmetic operators: +-*/(non-divisible)% (modulo) + +--+ = =

III. Basic data types

1. Basic data type: Number , string , boolean, undefined, null

undefined: non-existent variable

null: No value or null value

====================

2. typeof returns a string of data type

3, the value of the special values:

    • Infinity 1e309
    • -infinity 5e-324

typeof Infinity ==> "number"

Infinity-infinity ==>nan: (not digital)

    • Infinity The result of arithmetic running with any other operand is also equal to infinity

Infinity+20 ==>infinity

    • nan Special number : Nan is contagious, there is a nan in arithmetic operation, the whole result is Nan

typeof NaN ==> "number"

1+2+nan==>nan

Note 003: Basic data types, operators, control statements

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.