TIL I learned that if you set the `length` property of a javascript array, it will truncate it. So bizarre.
```
a = [1,2,3]
a.length = 0
a === []
```
TIL I learned that if you set the `length` property of a javascript array, it will truncate it. So bizarre.
```
a = [1,2,3]
a.length = 0
a === []
```
You should also learn today Not to do „TIL I learned“ xD
That’s false, because === compares references, not contents. You’re comparing:
a → an existing (now empty) array object
[] → a brand new empty array object
Same contents, different identity.
you're right that it doesn't compare by value, but I was just trying to communicate that the array is indeed empty
I understand that is is used sometimes for performance because it doesn't allocate memory
javascript is so fun. i love these quirks.