| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ko/docs/Web/API/Web_Workers_API/Structured_clone_algorithm | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
The structured clone JavaScript HTML5 specification . JSON . . structured clone JSON .
. .
JSON structured clone .
RegExp ..Blob, File FileList ..ImageData . CanvasPixelArray(dimensions) match .Error Function structured clone ; DATA_CLONE_ERR exception .DATA_CLONE_ERR exception .RegExp lastIndex .| Object type | Notes |
|---|---|
| All primitive types | . |
| Boolean object | |
| String object | |
| Date | |
| RegExp | lastIndex . |
Blob |
|
File |
|
FileList |
|
| ArrayBuffer | |
| ArrayBufferView | int32Array typed arrays . |
ImageData |
|
| Array | |
| Object | plain .(e.g. ) |
| Map | |
| Set |
(deep copy) ( ), . .
function clone(objectToBeCloned) {
// Basis.
if (!(objectToBeCloned instanceof Object)) {
return objectToBeCloned;
}
var objectClone;
// Filter out special objects.
var Constructor = objectToBeCloned.constructor;
switch (Constructor) {
// Implement other special objects here.
case RegExp:
objectClone = new Constructor(objectToBeCloned);
break;
case Date:
objectClone = new Constructor(objectToBeCloned.getTime());
break;
default:
objectClone = new Constructor();
}
// Clone each property.
for (var prop in objectToBeCloned) {
objectClone[prop] = clone(objectToBeCloned[prop]);
}
return objectClone;
}
window.historywindow.postMessage()This page was last modified on 2025 6 27 by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |