A systematic review of 15 native object types in javascript


previous words

  In programming languages, the types of values ​​that can be represented and manipulated are called data types. The most basic feature of programming languages ​​is that they can support multiple data types. JavaScript has a powerful type system, mainly including native objects, host objects and browser extension objects. This article mainly introduces 15 native object type systems.

 

Native objects (15 types)

  Primitive objects are divided into two categories: primitive types and object types . Primitive types are divided into two categories, one is null value, the other is wrapper object; object types can also be divided into two categories: one is constructor object, the other is single built-in object

 

Null (2 types)

  Unlike other languages, javascript has two values ​​that represent null values, namely undefined and null . Logically, undefined represents the null value of the primitive type, and null represents the null value of the object type

Packaging objects (3 types)

  Strings , numbers , and booleans are primitive types. However, due to the nature of its wrapper object , properties and methods can be called

Constructor object (9 types)

  Ordinary objects are unordered collections of named values, but through different constructors, javascript defines a variety of objects with different functions, including object Object , function Function , date Date , array Array , error Error , regular RegExp

  [Note] If you explicitly use the new constructor function to define the wrapper object, then the string String , number number , and Boolean value boolean also belong to the constructor object

Single built-in objects (4 types)

  Monolithic built-in objects include Math , JSON , global objects and arguments . They do not need to be declared or constructed with a constructor, and can be used directly in the corresponding scene

 

  The following is a detailed description directory of each type of object

  JavaScript Type System - Undefined and Null

  javascript type system - Number numeric type

  javascript type system - String string type

  javascript type system - Boolean Boolean type

 

  javascript type system - Object object type

  javascript type system - Function function type

  javascript type system - Array array type

  javascript type system - RegExp regular type

  javascript type system - Date datetime type

  javascript type system - Error error type

 

  javascript type system - Math object

  javascript type system - JSON object

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325483625&siteId=291194637