Home > front end >  For help about the es5 class
For help about the es5 class

Time:09-27

Why can't read parameters o attr

CodePudding user response:

Code cutoff point

CodePudding user response:

Reply can't send pictures, just want to add a method to the person class setAttr (attr, value), can be dynamically added to the person instance attributes and attribute values

CodePudding user response:

This [attr]=value;

CodePudding user response:

reference 3 floor sky waves reply:
this [attr]=value;

Thank you! But I want to know why

CodePudding user response:

reference 4 floor m0_46480405 response:
Quote: reference 3 floor sky waves reply:
this [attr]=value;

Thank you! But I want to know why


You write the attr is dead, and this is to use the parameters

CodePudding user response:

reference 4 floor m0_46480405 response:
Quote: reference 3 floor sky waves reply:
this [attr]=value;

Thank you! But I want to know why

This. Attr mean access object attribute name is "attr" attribute,

But attr not object property names, attr is variable, attr variable string value is the object of the property name,

This [] string values mean the string value attributes of the object as a name

Such as the string value of the attr "name"
This [attr] is equal to this [" name "] is this. The name

  • Related