Home > Article > Web Front-end > Consolidation study notes on basic knowledge of JS objects
1. Objects have unique identification. Even two objects that are exactly the same are not the same object. (The memory addresses of objects created by js are different)
2. Objects have states. The same object may be in different states (properties of js objects)
3. Objects have behavior. The state of the object may be because His behavior changes (attributes of the js object)
Uniqueness of js objects: highly dynamic, js gives users the ability to modify the state and behavior of the object at runtime
Properties describe the object
数据属性 value writable enumerable configurable 访问属性 get set
Special knowledge points
1.toString();//报错 1 .toString();// 1 (1).toString();//1
Lexical analysis and syntax analysis
Boxing conversion
每一种基本类型 Number String Boolean 再对象中都有对应的类(产生临时的对象)
Unboxing operation
把对象转换成原始类型的值 用于对象与原始类型值对比或者计算 toprimitive(input,preferedType); 过程: 1、输入原始值 直接返回 2、输入对象 调用input.valueOf() 如果是原始值 直接返回 3、调用input.toString() 如果是原始值 直接返回 4、报错 例如 []+[] = '' ;[]+{} = '[object object]';{}+[]=0 ;+[]=0;
Implicit conversion will have an unboxing process
转换为同等类型 == +
If there is no implicit conversion, there will be an unboxing process
===
Recommended tutorial: "JS Tutorial 》
The above is the detailed content of Consolidation study notes on basic knowledge of JS objects. For more information, please follow other related articles on the PHP Chinese website!