javascript has ternary state