Dirac Bracket Notation Javascript