LiveOverflow · youtube · en
1Overwriting the toString() method of a JavaScript object to return a specific value causes that value to be displayed when the object is stringified.
“That function is called whenever you want to get a string representation of that object. So if I return 1337 object as a string, and I would alert this object, it would call to string and show me that one.”
spoken · 395s · 2017-03-13
LiveOverflow · youtube · en
2Overwriting the toString() method to set array references to null and a 'stale' property to null causes the garbage collector to free the array.
“It first sets the reference to the array we just created to null, as well as setting another property to null. In a second you will see that this "stale" property is also a reference to the arr array.”
spoken · 412s · 2017-03-13