I’ve notice some calls to “delete” sprinkled throughout the code and I am wondering why we would prefer delete versus simply setting to undefined? This jsperf test shows undefined is faster by far:
http://jsperf.com/delete-vs-undefined-vs-null/6
Also, delete (by design) does not always succeed, it returns true or false because on whether the property was deleted or not. In the case of assigning undefined, the value will always end up undefined. For prototype based objects, I’m pretty sure delete kills performance as well.
This article seems to go pretty in-depth, but I admit I haven’t read the entire thing yet: http://perfectionkills.com/understanding-delete/
Is there something I’m missing here?