Postgres Loop Through Array Javascript Documentation