<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pro-Tek Blog &#187; Clone an Object</title>
	<atom:link href="http://www.pro-tekconsulting.com/blog/tag/clone-an-object/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pro-tekconsulting.com/blog</link>
	<description>For UI developers / UI designers and UI trends</description>
	<lastBuildDate>Thu, 05 Sep 2019 03:59:47 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.0.34</generator>
	<item>
		<title>HOW DO YOU CLONE AN OBJECT?</title>
		<link>http://www.pro-tekconsulting.com/blog/how-do-you-clone-an-object/</link>
		<comments>http://www.pro-tekconsulting.com/blog/how-do-you-clone-an-object/#comments</comments>
		<pubDate>Fri, 09 Mar 2018 02:11:30 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Java platform]]></category>
		<category><![CDATA[Clone an Object]]></category>

		<guid isPermaLink="false">http://www.pro-tekconsulting.com/blog/?p=2437</guid>
		<description><![CDATA[<p>How do you clone an object? var obj = {a: 1 ,b: 2} var objclone = Object.assign({},obj); Now the value of objclone is {a: 1 ,b: 2} but points to a different object than obj. Note the potential pitfall, though: Object.clone() will just do a shallow copy, not a deep copy. This means that nested [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog/how-do-you-clone-an-object/">HOW DO YOU CLONE AN OBJECT?</a> appeared first on <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog">Pro-Tek Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h4>How do you clone an object?</h4>
<p>var obj = {a: 1 ,b: 2}<br />
var objclone = Object.assign({},obj);<br />
Now the value of objclone is {a: 1 ,b: 2} but points to a different object than obj.<br />
Note the potential pitfall, though: Object.clone() will just do a shallow copy, not a deep copy. This means that nested objects aren’t copied. They still refer to the same nested objects as the original:<br />
let obj = {<br />
a: 1,<br />
b: 2,<br />
c: {<br />
age: 30<br />
}<br />
};</p>
<p>var objclone = Object.assign({},obj);<br />
console.log(&#8216;objclone: &#8216;, objclone);</p>
<p>console.log(&#8216;After Change &#8211; obj: &#8216;, obj); // 45 &#8211; This also changes<br />
console.log(&#8216;After Change &#8211; objclone: &#8216;, objclone); // 45</p>
<p>The post <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog/how-do-you-clone-an-object/">HOW DO YOU CLONE AN OBJECT?</a> appeared first on <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog">Pro-Tek Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pro-tekconsulting.com/blog/how-do-you-clone-an-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
