You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/07-object-properties/02-property-accessors/article.md
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -85,11 +85,12 @@ alert(user.surname); // Cooper
85
85
Now we have a "virtual" property. It is readable and writable, but in fact does not exist.
86
86
87
87
```smart header="Accessor properties are only accessible with get/set"
88
-
A property can either be a "data property" or an "accessor property", but not both.
88
+
Once a property is defined with `get prop()` or `set prop()`, it's an accessor property, not a data properety any more.
89
89
90
-
Once a property is defined with `get prop()` or `set prop()`, it's an accessor property. So there must be a getter to read it, and must be a setter if we want to assign it.
90
+
- If there's a getter -- we can read `object.prop`, othrewise we can't.
91
+
- If there's a setter -- we can set `object.prop=...`, othrewise we can't.
91
92
92
-
Sometimes it's normal that there's only a setter or only a getter. But the property won't be readable or writable in that case.
93
+
And in either case we can't `delete` an accessor property.
0 commit comments