Considering this:
var p = function(){}; p.prototype = { id : null, arr : []} var a = new p(); var b = new p(); a.id = 1; a.arr.push(5); alert(b.arr[0]);
The warning reads 5
, which means that a.arr == b.arr, however a.id and b.id are separate (a.id! = B.id). How can I make a.arr! = B.arr?
Limitations:
p should be able to use new p()
. Or, there must be a way to make unique p.
source share