Damus
hodlbod profile picture
hodlbod
@hodlbod
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 === []
```
8❤️2‼️1
wolfpy · 9w
You should also learn today Not to do „TIL I learned“ xD
nostrich · 9w
Truly awful. It should be a read-only attribute or method.
Olivia · 9w
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.
Leito · 9w
I understand that is is used sometimes for performance because it doesn't allocate memory
ben · 9w
javascript is so fun. i love these quirks.