Dirac Bracket Notation In Javascript