Can't seem to clone a bitmap

function cloneObject(x){    return Object.create( x ); // still doesn't work...// return Object.assign({}, x); // does not work...// Afaik JQuery is not supported in RPG Maker so all those solutions are a no-go anyway.};I also found this:

Object.extend = function(destination, source) { for (var property in source) destination[property] = source[property]; return destination;};// ERROR: caller, callee and arguments may not be accessed on strict mode.Object.deepExtend = function(destination, source) {  for (var property in source) {    if (typeof source[property] === "object" &&     source[property] !== null ) {      destination[property] = destination[property] || {};      arguments.callee(destination[property], source[property]);    } else {      destination[property] = source[property];    }  }  return destination;};// ERROR: caller, callee and arguments may not be accessed on strict mode.But that one throws an error when writing in strict mode...

How can I clone a bitmap...
Maybe the problem is that the window is created multiple times without being destroyed. But removing a window from the Scene's children and deleting all references to it should remove it from memory right?
Also, is there a way to get all the references to a window to make sure there isn't something referencing it?
I kinda miss the dispose()...

Okay after some more testing, there is only 1 window instance active. And after some more testing I found out that the cloning is the problem (because a new Bitmap(1000,1000) does work, but cloning not). How do I clone a bitmap..

Oh well. I'll just blt() the original map onto a new bitmap object because that seems to work and I don't need to copy most properties anyway.
one of the solutions on stack is to do:

object = {something: 'value'};object.self = object;http://stackoverflow.com/questions/122102/what-is-the-most-efficient-way-to-clone-an-objectI personally use lodash's clone method.
Depending on what you want to do, you could create a PIXI.RenderTexture, render the bitmap's baseTexture on it and use that to create a new sprite. I don't have a working example ready, but it should work.

Original thread: https://forums.rpgmakerweb.com/threads/cant-seem-to-clone-a-bitmap.51466/