Naviaže zdroj na životnosť objektu — pri jeho zániku sa zdroj uvoľní sám.
class FileGuard { constructor(path) { // Acquiring the resource is part of creating the object. this.file = File.open(path); } // Destroying the object releases it. Not a step of the program, a consequence. [Symbol.dispose]() { this.file.close(); }} function process(path) { using guard = new FileGuard(path); write(guard.file); checkPermissions(); // an error can fly out from here // End of block. There is no close() anywhere — and the file is closed anyway.}