{"id":846,"date":"2024-11-28T17:01:31","date_gmt":"2024-11-28T08:01:31","guid":{"rendered":"https:\/\/blog.mydepot.kr\/?p=846"},"modified":"2024-11-28T17:01:31","modified_gmt":"2024-11-28T08:01:31","slug":"javascript-%eb%b0%b0%ec%97%b4%ea%b3%bc-%ea%b0%9d%ec%b2%b4-%ec%96%95%ec%9d%80%eb%b3%b5%ec%82%ac-%ea%b9%8a%ec%9d%80%eb%b3%b5%ec%82%ac","status":"publish","type":"post","link":"https:\/\/blog.mydepot.kr\/?p=846","title":{"rendered":"[Javascript] \ubc30\uc5f4\uacfc \uac1d\uccb4 \uc595\uc740\ubcf5\uc0ac\/\uae4a\uc740\ubcf5\uc0ac"},"content":{"rendered":"<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\n\/\/ 1. \uc2a4\ud504\ub808\ub4dc \uc5f0\uc0b0\uc790 \uc0ac\uc6a9 (\uc595\uc740 \ubcf5\uc0ac)\nconst originalArray = &#x5B;1, 2, 3];\nconst copiedArray1 = &#x5B;...originalArray];\n\n\/\/ 2. slice() \uba54\uc11c\ub4dc \uc0ac\uc6a9 (\uc595\uc740 \ubcf5\uc0ac)\nconst copiedArray2 = originalArray.slice();\n\n\/\/ 3. JSON \ubc29\uc2dd \uc0ac\uc6a9 (\uae4a\uc740 \ubcf5\uc0ac)\nconst copiedArray3 = JSON.parse(JSON.stringify(originalArray));\n\n\/\/ 4. Array.from() \uc0ac\uc6a9 (\uc595\uc740 \ubcf5\uc0ac)\nconst copiedArray4 = Array.from(originalArray);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\n\/\/ 1. \uc2a4\ud504\ub808\ub4dc \uc5f0\uc0b0\uc790 \uc0ac\uc6a9 (\uc595\uc740 \ubcf5\uc0ac)\nconst originalObj = { name: &#039;\uae40\ucca0\uc218&#039;, age: 25 };\nconst copiedObj1 = { ...originalObj };\n\n\/\/ 2. Object.assign() \uc0ac\uc6a9 (\uc595\uc740 \ubcf5\uc0ac)\nconst copiedObj2 = Object.assign({}, originalObj);\n\n\/\/ 3. JSON \ubc29\uc2dd \uc0ac\uc6a9 (\uae4a\uc740 \ubcf5\uc0ac)\nconst copiedObj3 = JSON.parse(JSON.stringify(originalObj));\n\n\/\/ 4. structuredClone() \uc0ac\uc6a9 (\uae4a\uc740 \ubcf5\uc0ac, \ucd5c\uc2e0 \ube0c\ub77c\uc6b0\uc800)\nconst copiedObj4 = structuredClone(originalObj);\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<p>\ubc30\uc5f4\uacfc \uac1d\uccb4 \uc0c1\uad00\uc5c6\uc774 \uac04\ub2e8\ud558\uac8c \uae4a\uc740 \ubcf5\uc0ac\ub97c \ud558\ub824\uba74 structuredClone \ub97c \uc0ac\uc6a9\ud558\uba74 \ub41c\ub2e4.<\/p>\n\n\n\n<p>\ub2e8, \uad6c\ud615 \ube0c\ub77c\uc6b0\uc800\uc5d0\uc11c\ub294 \uc2e4\ud589\uc774 \ub418\uc9c0 \uc54a\uc744 \uc218 \uc788\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ubc30\uc5f4\uacfc \uac1d\uccb4 \uc0c1\uad00\uc5c6\uc774 \uac04\ub2e8\ud558\uac8c \uae4a\uc740 \ubcf5\uc0ac\ub97c \ud558\ub824\uba74 structuredClone \ub97c \uc0ac\uc6a9\ud558\uba74 \ub41c\ub2e4. \ub2e8, \uad6c\ud615 \ube0c\ub77c\uc6b0\uc800\uc5d0\uc11c\ub294 \uc2e4\ud589\uc774 \ub418\uc9c0 \uc54a\uc744 \uc218 \uc788\ub2e4.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[96],"tags":[140,268,349,437,438,439],"class_list":["post-846","post","type-post","status-publish","format-standard","hentry","category-subdepot","tag-140","tag-javascript","tag-349","tag-copy","tag-438","tag-439"],"modified_by":"\ucc38\ube5b\ubc14\ub2e4","_links":{"self":[{"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/posts\/846","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=846"}],"version-history":[{"count":1,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/posts\/846\/revisions"}],"predecessor-version":[{"id":847,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/posts\/846\/revisions\/847"}],"wp:attachment":[{"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=846"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=846"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=846"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}