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

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -