This content has been marked as final.
Show 1 reply
-
1. Re: [JS][CC] checking an Array using IndexOf
Jump_Over Nov 27, 2013 6:38 AM (in response to Roy Marshall)Hi,
I suggest to combine 2 in 1:
I.e.:
Array.prototype.pushUnique = function (item) { var push = true; for (var k = 0; k < this.length; k++) if (this[k] == item) {push = false; break } if (push) this.push(item); } myArray.pushUnique(value);... or the same with a 'function' way. As far as I know the difference is prototype RAM consuming (if many objects present) but that's only what I read about somewhere..., can't prove it
Jarek


