This JavaScript preprocessing tool allows you to create a label and then goto it using this syntax:
[lbl] <label-name>
goto <label-name>
For example, the example in the question can be written as follows:
[lbl] start:
alert("LATHER");
alert("RINSE");
[lbl] repeat: goto start;
Note that you are not just limited to simple trivial programs like an endless LATHER RINSE repeat cycle—the possibilities afforded by goto are endless and you can even make a Hello, world! message to the JavaScript console 538 times, like this:
var i = 0;
[lbl] start:
console.log("Hello, world!");
i++;
if(i < 538) goto start;
You can read more about how goto is implemented, but basically, it does some JavaScript preprocessing that takes advantage of the fact that you can simulate a goto with a labelled while loop. So, when you write the "Hello, world!" program above, it gets translated to something like this:
var i = 0;
start: while(true) {
console.log("Hello, world!");
i++;
if(i < 538) continue start;
break;
}
There are some limitations to this preprocessing process, because while loops cannot stretch across multiple functions or blocks. That's not a big deal, though—I'm sure the benefits of being able to take advantage of goto in JavaScript will absolutely overwhelm you.
All above link that lead to goto.js library is ALL DEAD, here is links needed:
goto.js (uncompressed) --- parseScripts.js (uncompressed)