I have put together a small test, can someone explain why does JavaScript do the following?
Why will testArr inherit the modifications of newArray?
var TestClass = function() {
            this.testArr = [10,11];
            this.addToArray = function() {
                var newArray = this.testArr;
                newArray.push(12);
            }
        }
        var testClass = new TestClass();
        testClass.addToArray();
        console.log(testClass.testArr); // will be [10, 11, 12]
 
     
     
    