javascript - Array filter to return a string -


i have array , using filter function arrays check duplicates:

var array = [hello, world, hello, hi, how you];         var uniquearray = array.filter(function(item, pos) {           return array.indexof(item) == pos;         });     return uniquearray.join(","); 

now return unique array string , unknown reason failing. documentation, shows returns array how can convert unique array string?

add quotes strings !

var array = ['hello', 'world', 'hello', 'hi', 'how you']; var uniquearray = array.filter(function(item, pos) {   return array.indexof(item) === pos; }); return uniquearray.join(","); 

Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -