Postgres For Loop Continue Javascript Interview Question