A with statement in python is useful for cleaning up resources, e.g.
with open('file.txt', 'w') as f:
// do something with the file
the writer of the code does not have to worry about closing the file, because writer of the open function has implemented necessary stuff to clean up file resources.
What are the common patterns in javascript to achieve this functionality?