2

I write some code for goto like, below

start:
    console.log("Hello");
    repeat: goto start

show the unexpected identifier

repeat: goto start

on this line

can I use goto in a node or not please help

Amit Patel
  • 167
  • 2
  • 12

1 Answers1

3

There is no goto keyword in javascript. The reason being it provides a way to branch in an arbitrary and unstructured manner. This might make a goto statement hard to understand and maintain. But there are still other ways to get the desired result. The method for getting the goto result in JavaScript is use of Break and Continue.

REFERENCE: https://www.geeksforgeeks.org/how-to-use-goto-in-javascript/

Karan Sah
  • 152
  • 7