Have a look at underscore.js
: underscore.js
Then you can check the array as
_.contains(thelist, 'value you want to check');
// The full example
var thelist = new Array();
function addlist(){
var data = documentgetElementById('data').innerHTML;
if(!_.contains(thelist, data)) theList.push(data);
}
or you can add the values to the array without concerning the duplicate values, and after the adding process is finished, you can remove the duplicate elements by
theList = _.uniq(theList);
The second method of course less efficient.