Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all articles
Browse latest Browse all 37788

Re: [JS][CC] checking an Array using IndexOf

$
0
0

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


Viewing all articles
Browse latest Browse all 37788

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>