How to clone something with JavaScript ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

How to clone something with JavaScript ?

I want to clone something with JavaScript , how could i do that ?

26th Nov 2018, 8:34 AM
Bono
Bono - avatar
9 Answers
26th Nov 2018, 2:55 PM
CalviÕ²
CalviÕ² - avatar
+ 6
CalviÕ² ęˆ‘ęƒ³č¦å¤åˆ¶ēƒ šŸ”“
26th Nov 2018, 1:05 PM
Bono
Bono - avatar
+ 6
I want to clone circles or balls āŗā­•
26th Nov 2018, 1:07 PM
Bono
Bono - avatar
+ 4
CalviÕ² I never thought it was as simple, miracles of JavaScript :-D
26th Nov 2018, 9:49 AM
Ipang
+ 3
var x=1; var y=x; // you already cloned y with x. šŸ˜…
26th Nov 2018, 8:45 AM
CalviÕ²
CalviÕ² - avatar
+ 3
Bono Don't try that with Arrays, if you do, you'll get unexpected results coz you didn't actually clone anything
26th Nov 2018, 10:37 AM
Dlite
Dlite - avatar
+ 2
Ipang That's the simplest form of clone. Of course if we want to clone a multilevel array, it would be more complicated. Anyway the question not mention so.
26th Nov 2018, 9:58 AM
CalviÕ²
CalviÕ² - avatar
+ 1
Bono ä½ ę‰“ē®—复制什么 åÆ仄ē”Øäø­ę–‡ä¹¦å†™?
26th Nov 2018, 10:00 AM
CalviÕ²
CalviÕ² - avatar
0
šŸ¤£
26th Nov 2018, 9:53 AM
CalviÕ²
CalviÕ² - avatar