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/04-object-basics/01-object/article.md
+12-2
Original file line number
Diff line number
Diff line change
@@ -105,7 +105,6 @@ That's because the dot requires the key to be a valid variable identifier. That
105
105
106
106
There's an alternative "square bracket notation" that works with any string:
107
107
108
-
109
108
```js run
110
109
let user = {};
111
110
@@ -130,7 +129,7 @@ let key = "likes birds";
130
129
user[key] =true;
131
130
```
132
131
133
-
Here, the variable `key` may be calculated at run-time or depend on the user input. And then we use it to access the property. That gives us a great deal of flexibility. The dot notation cannot be used in a similar way.
132
+
Here, the variable `key` may be calculated at run-time or depend on the user input. And then we use it to access the property. That gives us a great deal of flexibility.
134
133
135
134
For instance:
136
135
@@ -146,6 +145,17 @@ let key = prompt("What do you want to know about the user?", "name");
0 commit comments