My opinion is that goto isn’t needed anymore. In imperative programming goto were needed to add a dimension to a linear code execution. In OOP or functional programming today it is obsolete.
because they support way clearer statements instead, which give a clearer defined purpose. Goto really is very hacky and can go awfully wrong. If you, instead, use a foreach method, the loop is better defined, because it does not set an arbitrary mark somewhere in the program you can jump to from anywhere.
While JavaScript doesn't have goto, the closest thing it does have are 'labels'. You can give a statement a name, then later use break inside that at any point to break out of it. They call it a 'loop jump' and it's part of JavaScript that nobody really uses: developer.mozilla.org/en/docs/Web/JavaScript/Refe…
Marcus
Full Stack Developer
I would recommend not using "goto" for better code. I used to write large assembly programs and a goto could really be hard to debug if you change something and forget you referenced that in some other line.