+ 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 Antworten
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