javascript record check if key exists