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

python - jinja2: TemplateSyntaxError: expected token ',', got 'string' -

Qt4: how to send QString inside a struct via QSharedMemory -

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -