Best way for checking if a Id is repeated in javascript [performance] -


i have list of repeated products it's ids, having loop want each product goes once through loop. want prevent product going through next times.

i want know best way of doing this:

1)

var hansalido = {}; if(typeof(hansalido[productgroup.getvalue()]) == 'undefined'){                             hansalido[productgroup.getvalue()] = true;                         }else{                             continue;                         } 

2)

var hansalido = []; if(hansalido.indexof(productgroup.getvalue()) > -1){     continue; }else{     hansalido.push(productgroup.getvalue()); } 

3) other way


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -