JavaScript basic data types knowledge summary

Article Directory


javascript data types fall into two categories. As follows:
the basic data type
    number, string, null, boolean and undefined.
Reference data type
    function (function), the object (object), the array (Array)
Next, the basic data types to be summarized.

boolean

    Boolean value that only two values: true or false. Case-sensitive, that is, True and False Boolean value but not identifiers.

number

  1. Values ​​are stored in JavaScript in IEEE 754 double-precision floating-point format
  2. Type beyond its numerical range expressed by the Infinity (positive infinity) or -Infinity (minus infinity), respectively.
  3. JavaScript support octal and hexadecimal. Octal begin with 0, hexadecimal begin with 0x or 0X
  4. It expressed support for scientific notation. As representatives 5.12e2 5.12 10 ^ multiplied by 2, e is not case sensitive.
  5. Any non-numeric value divided by the return NaN
  6. Operations involving a NaN (NaN / 10) returns NaN.

string

  1. String must be enclosed in quotes, single quotes may be, it may be a double quotes.
  2. Compares two strings are equal == character sequence can be used, without using equals ()

null

  1. Undefined null value and equal, but not equal to type, if the comparison is not precise, it is often undefined and null are equal, returns true null == undefined i.e.
  2. It indicates that no undefined variables are set to values ​​or property does not exist, there is a variable representing a null value, but the value is null
  3. null data type is an object, for historical reasons, have tried to modify the specification typeof null returns "null", after a large number of sites inaccessible, for compatibility, or for historical reasons returns "object".

undefined

    When uninitialized variable var declared, this variable is undefined

发布了41 篇原创文章 · 获赞 15 · 访问量 1万+

Guess you like

Origin blog.csdn.net/weixin_43616178/article/details/103754215