convert distinct results to JavaScript array of strings