Turing Machine using JavaScript