Javascript interpreter now works for all test cases

And fixed a few edge cases i noticed that the tests didn't pick up on.