I know that break, continue, and return functions are built-in.
But I saw http://summerofgoto.com/ which allow to write goto <label>.
What should we write so that we can call funcitons like this?
N.B: I get the error : Missing ; before statement if I write foo bar;
You can not. “Summerofgoto” / “goto.js” is using an awkward hack to enable this statement: it parses the JS source code line by line and uses Regular Expressions to find patterns like “goto xy;”.
Basically, “goto.js” it is a preprocessor for JavaScript which rewrites your actual code (containing labels and goto) into regular JS – it replaces your labels and goto statements to functions and function calls.
You could do the same thing, though. However, for performance reasons i strongly suggest you don’t.
“break” and the like are not functions, they are statements which are part of the core language. thats a whole different thing.