Simple javascript Turing machine