原始类型构造函数(Primitive type constructor)

一、原始类型构造函数

      new Boolean()  –>object(对象)

      Boolean(值)  将值转换为对应的类型     基本数据类型

      实例方法:由构造函数创建的对象使用。

      静态方法:由构造函数本身去使用

二、Number

     1、静态成员

         1.1  isNan( )   判断是否不是一个数

         1.2  isFinite( )   判断是否是有限的

         1.3  parseInt( )   将一个字符串类型的数据转换为整数

                **   parseInt(),可以传入第二个参数,表示将给定字符串识别为多少进制   **

         1.4  parseFloat( )   将一个字符串类型的数据转换为浮点数

                1.4.1  要求第一个参数为字符串,如果不是字符串,会自动转换为字符串

                1.4.2  从字符串的开始位置进行查询,找到有效的数字进行转换,如果没有有效的数字,直接返回NaN,(从头到尾没有有效数字)

                          如果碰到了非有效数字,停止转换(即前面有有效数字并进行了转换)。

                1.4.3  左右有空白自动忽略

      2、实例成员

          -length 字符串的长度

          2.1  concat  :concat()方法用于合并两个或多个数组。此方法不会更改现有数组,而是返回一个新数组。

          2.2  slice : slice()方法返回一个新的数组对象,这一对象是一个由begin 和 end 决定的原数组的浅拷贝(包括begin,不包括end),不会改变原始数组。

          2.3  split :split()方法使用指定的分隔符字符串将一个String对象分割成子字符串数组,以一个指定的分割字串来决定每个拆分的位置

          2.4  includes : 查询字符串中是否存在某个字符,返回 true/false

          2.5  endsWith:判断字符串是否以某个字符串结尾

          2.6  startsWith :判断字符串是否以某个字符串开头

          2.7  padStart :以指定的字符串,填充到指定的长度

          2.8  repeat :repeat()构造并返回一个新字符串,该字符串包含被连接在一起的指定数量的字符串的副本

三、Array

       1、静态成员

            1.1  from():将一个类数组转换为真数组

            1.2  isArray():判断一个给定的数组是否是一个真数组

       2、实例成员

            – push() 向数组中尾部添加一个或者多个数据  返回值(添加之后的数组长度)

            – shift() 删除数组中头部的一个数据  返回值(被删除的数据)

            – pop()删除数组尾部的一个数据  返回被删除的数据

            – unshift()向数组头部添加一个或多个数据  返回添加之后的数据长度

            – splice(starti,删除个数,插入的数据)

            – reverse() 将当前数组进行颠倒顺序

————————

< strong > I. primitive type constructor < / strong >

new Boolean()   –& gt; Object

Boolean (value)   Convert the value to the corresponding type      Basic data type

< Strong > instance method: < / strong > used by the object created by the constructor.

< Strong > static method: < / strong > it is used by the constructor itself

二、Number

     1. Static member < / strong >

         1.1   isNan( )   Determine whether it is not a number

one point two   isFinite( )   Judge whether it is limited

one point three   parseInt( )   Converts a string type of data to an integer

**   Parseint(), you can pass in the second parameter, which indicates how many hexadecimals the given string is recognized as   **

one point four   parseFloat( )   Converts a string type of data to a floating point number

1.4.1   The first parameter is required to be a string. If it is not a string, it will be automatically converted to a string

1.4.2   Query from the beginning of the string to find a valid number for conversion. If there is no valid number, it will directly return Nan (there is no valid number from beginning to end)

If a non significant digit is encountered, stop the conversion (i.e. there is a significant digit in front and the conversion is carried out).

1.4.3   If there is blank space on the left and right, it will be ignored automatically

< Strong > 2. Instance member < / strong >

          – length the length of the string

two point one   concat   : The concat () method is used to combine two or more arrays. This method does not change the existing array, but returns a new array.

two point two   Slice: the slice () method returns a new array object, which is a shallow copy of the original array determined by begin and end (including begin but not end), and will not change the original array.

two point three   Split: the split () method uses the specified separator string to divide a string object into a substring array, and uses a specified split string to determine the position of each split

two point four   Includes: query whether a character exists in the string and return true / false

two point five   Endswith: determines whether a string ends with a string

two point six   Startswith: determines whether a string starts with a string

two point seven   Padstart: fills the specified length with the specified string

two point eight   Repeat: repeat() constructs and returns a new string that contains a specified number of copies of strings that are concatenated together

三、Array

< Strong > 1. Static member < / strong >

            1.1   From(): converts an array of classes to a true array

one point two   Isarray(): judge whether a given array is a true array

< Strong > 2. Instance member < / strong >

            – push() adds one or more data to the tail of the array   Return value (array length after addition)

< strong>            – shift() deletes a header in the array   Return value (deleted data)

– Pop() deletes a data at the end of the array   Return deleted data

– Unshift() adds one or more data to the array header   Returns the length of data after addition

– Splice (starti, number of deletes, inserted data)

– Reverse() reverses the order of the current array