Javascript String Array Functions Postgres