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
All keys are converted to strings, Except for Symbols
68
74
`key: value === string: data`
69
75
70
76
## 3. Accessing Object Properties
71
77
72
-
### ACCESSING DATA
78
+
### ACCESSING DATA
73
79
74
80
```
75
81
// This is converted
@@ -85,7 +91,7 @@ const numbers = {
85
91
86
92
```
87
93
88
-
Why would you use square brackets aside from if you tried to store numbers as a key, Well sometimes you have property names that may not be valid JavaScript identifiers. Now, an identifier in JS is like the name of a variable.
94
+
Why would you use square brackets aside from if you tried to store numbers as a key, Well sometimes you have property names that may not be valid JavaScript identifiers. Now, an identifier in JS is like the name of a variable.
Another reason sometimes you want to use a dynamic value like a variable to access data from an object.
110
+
Another reason sometimes you want to use a dynamic value like a variable to access data from an object.
105
111
106
112
```
107
113
const palette = {
@@ -127,7 +133,7 @@ as a identifier like **let 76games = 'NBA team'**
127
133
It's similar to viewing a property or accessing the data. We have the dot notation or the square brackets. The only difference is we use an equal sign to assign a value either to update that value or to give it an initial value.
Arrays and Objects behave the same way when we checking for equality we are comparing Reference Types Addresses.
200
+
201
+
When we compare with == or ====, we're comparing these memory slot addresses, variables might look the same, but it has it's own completely unique place in memory.
202
+
203
+
```
204
+
let nums = [1, 2, 3];
205
+
let mystery = [1, 2, 3];
206
+
207
+
console.log(nums == mystery); // false
208
+
console.log(nums === mystery); // false
209
+
210
+
nums -> 12873612783
211
+
mystery -> 9912873621
212
+
213
+
let moreNums = nums;
214
+
console.log(nums === moreNums); // true
215
+
```
216
+
217
+
This means if you're trying to compare arrays, if you're trying to see if an array is equal to another array, it's not as straightforward as you might hope it would be, because a lot of times you're not trying to check if an array is the exact same array, Instead you often want to check if they look the same, if they contain the same information.
218
+
219
+
220
+
So the next thing that it's a little trickier is trying to check if an array contains or looks like another array that isn't empty.
221
+
222
+
So if i wanted to know if one array contained exactly the numbers one, two and three in that order, unfortunately there's not an easy option for us right now until we talk about loops. We don't really have a way of checking for array equality of values, what we will need to do is manually compare every element in an array to another array.
223
+
224
+
**The exact same thing holds true for objects.**
225
+
226
+
```
186
227
187
-
Array Object Equality
188
-
Arrays and Objects behave the same way when we checking for Equality We are comparing Reference Types Addresses
0 commit comments