Built-in object and packaging type: What is a built-in object? The built-in object is the built-in object that has been implemented by the browser vendor specified in the es standard. What else? There are 11 in total. Remember the number first. String number Boolean array date math regexperror error is also an object. Error. He also belongs to one of the eleven built-in objects. The eleven objects, function objectglobal global (window), both of them, have done two things. The first is to install data, second, in order to simplify your operations, you have provided a lot of ready-made APIs for you to operate on data.
Packing type: The built-in object is nothing more than asking you to write it in contempt, but the packaging type will be asked during an interview. The packaging type is the object that encapsulates the value of the original type and provides the operation value for the API. The value of the packaging type does two things. The first thing is to encapsulate a value and then provide APIs for this value operation. How to use it: Good news, you don't need to use it. They are all automatically created. When will they be automatically destroyed :? Look at his life cycle: when trying to use the original type value to call a function, it will automatically create the corresponding type of packaging type object. After the function is called, the system automatically releases an upper-case number in the memory, and an API in the upper-case number is called tofixed (d). When you try to call the function, after it is installed, does the tofixed call n? In fact, this is the essence of number. What is it like when Javascript is executed? When trying to use N to call tofixed, he did this, A new upper-case number is used to pack N. For example, a new string ("Zhang") is used to enclose Zhang "). charcodeat (); then charcodeat () is actually called Why string () has a packaging type: because the value of the original type itself cannot have any attributes and functions, it cannot be placed. Let's take a look at the last packaging type. primitivevalue is called the value of the original type. This value encapsulates your original "sheet.
Built-in object and packaging type