1 00:00:00,630 --> 00:00:04,000 In last video we started talking about the fourth rule around reducers. 2 00:00:04,190 --> 00:00:09,470 And we had added in a little bit more context to understanding exactly what the word mutate means in 3 00:00:09,530 --> 00:00:10,950 javascript. 4 00:00:10,970 --> 00:00:13,980 Now before you dive face first into this rule right. 5 00:00:14,000 --> 00:00:19,300 One other quick side topic I just want to flip back over to my counsel over here very quickly. 6 00:00:19,370 --> 00:00:21,060 One little thing I want to show you. 7 00:00:21,170 --> 00:00:26,420 So inside of this little terminal I'm going to define a new array called numbers and I'll give it the 8 00:00:26,420 --> 00:00:28,750 values 1 2 and 3. 9 00:00:28,760 --> 00:00:34,460 Now you might know that inside of javascript we can very easily compare equality between two values 10 00:00:34,460 --> 00:00:36,800 using the triple equals operator. 11 00:00:36,800 --> 00:00:42,270 So for example I can say one equals equals equals 1 and that's going to return true. 12 00:00:42,620 --> 00:00:45,180 Likewise I can do a string of high. 13 00:00:45,320 --> 00:00:47,080 Equals equals equals high. 14 00:00:47,150 --> 00:00:49,130 And that would turn true as well. 15 00:00:49,130 --> 00:00:54,050 And of course if I do one not equals two we're gonna get True. 16 00:00:54,080 --> 00:00:59,000 And 1 not equals 1 is going to be false because 1 and 1 are equal to each other. 17 00:00:59,000 --> 00:01:03,720 Now this comparison operator can be used on arrays in objects as well. 18 00:01:03,950 --> 00:01:09,620 So I can very easily say something like Does numbers equal or equal equal numbers like so and of course 19 00:01:09,620 --> 00:01:10,700 that is true. 20 00:01:11,000 --> 00:01:16,880 Now in the case of primitive values such as numbers and strings we can kind of imagine that this is 21 00:01:16,940 --> 00:01:18,530 a value comparison. 22 00:01:18,530 --> 00:01:23,010 In other words is the number one equal to the value of the number 1. 23 00:01:23,100 --> 00:01:27,960 But how comparison is done around arrays and objects is a little bit more subtle. 24 00:01:28,100 --> 00:01:33,890 You see when you use this triplet equals operator right here on an array javascript is checking to see 25 00:01:33,980 --> 00:01:40,220 if it is a reference to the exact same array in memory not the contents of the array. 26 00:01:40,220 --> 00:01:47,270 So for example if I say numbers numbers numbers equals a brand new array of 1 to 3 this is going to 27 00:01:47,270 --> 00:01:52,100 return false because the comparison here is not between the contents of the array. 28 00:01:52,100 --> 00:01:54,100 You'll notice those are identical. 29 00:01:54,110 --> 00:01:57,720 The comparison is between whether or not numbers. 30 00:01:57,860 --> 00:02:03,260 This variable right here is referencing the exact same array in memory as the one on the right hand 31 00:02:03,260 --> 00:02:04,910 side this one over here. 32 00:02:04,910 --> 00:02:06,780 In this case it is not. 33 00:02:06,800 --> 00:02:13,160 We declared this array up here that is in some location in memory or RAM on your computer and then you 34 00:02:13,170 --> 00:02:15,840 defined a completely new array down here. 35 00:02:15,840 --> 00:02:20,870 So you now have two separate arrays inside of RAM or memory on your computer. 36 00:02:20,920 --> 00:02:25,020 And so in this case these two separate arrays are clearly not the same array. 37 00:02:25,110 --> 00:02:29,760 So when we do this comparison it's going to return a value false because no it's not the same array 38 00:02:29,760 --> 00:02:31,560 in memory OK. 39 00:02:31,590 --> 00:02:33,200 Now we understand that. 40 00:02:33,330 --> 00:02:35,240 Let's take one more very brief pause. 41 00:02:35,250 --> 00:02:38,860 I promised last pause here and then we come back we'll finish up on this rule.