Today I learned a lesson. Consider this C# code:
List a = new List();
a.Add(1);
List b = new List(a);
While used to do it like this to get a fresh copy of the list, in JavaScript this happens:
var a = new Array()
a.push(1)
var b = [a]
So there is a new Array which 1st item is the Array to be copied.
I'm using it wrong, I know, it should be:
List b = a.Splice(0);
But hey, couldn't be this done by the compiler for me?
Today I learned a lesson. Consider this C# code:
List a = new List();
a.Add(1);
List b = new List(a);
While used to do it like this to get a fresh copy of the list, in JavaScript this happens:
var a = new Array()
a.push(1)
var b = [a]
So there is a new Array which 1st item is the Array to be copied.
I'm using it wrong, I know, it should be:
List b = a.Splice(0);
But hey, couldn't be this done by the compiler for me?