JavaScript new keyword and memory management

garbage-collection, javascript, memory-management

Solution

var component = new Component();
component = null; // delete this at next garbage collection

Problem

Coming from C++ it is hard grained into my mind that everytime I call `new` I call `delete`. In JavaScript I find myself calling `new` occasionally in my code but (hoping) the garbage collection functionality in the browser will take care of the mess for me. I don't like this - is there a `delete` method in JavaScript and is how I use it different from in C++? Thanks.

Original source

Related problems