Javascript's equivalent of destruct in object

2019-01-26 03:30发布

问题:

This question already has an answer here:

  • When are JavaScript objects destroyed? 4 answers

Since I've dealt in the past with javascript's funky "object model", I assume there is no such thing as a destructor. My searches were mildly unsuccessful, so you guys are my last well of hope. How do you execute stuff upon instance destruction?

回答1:

MDN is a nice resource for JS. No, there is nothing like calling a function when an object ceases.