

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Why doesn't JavaScript have a goto statement?
JavaScript has a goto statement, which is a reserved keyword. It isn’t popular since it is not needed in JavaScript. Generally, it isn’t considered a good practice to use a goto statement.
Using goto with JavaScript preprocessing is still considered good as shown below −
var a = 0; [lbl] beginning: console.log("Demo Text!"); a++; if(i < 424) goto beginning;
The above code gets translated like the following −
var a = 0; beginning: while(true) { console.log("Demo Text!"); a++; if(i < 424) continue beginning; break; }
- Related Questions & Answers
- Why doesn't JavaScript support multithreading?
- Why an interface doesn't have a constructor whereas an abstract class have a constructor in Java?
- Python3 - Why loop doesn't work?
- PHP goto Statement
- Why Training Doesn’t Help Your Organization!
- Why doesn't MySQL support millisecond / microsecond precision?
- Why doesn't C++ support functions returning arrays
- IN statement in SQL doesn’t accept a wild character (SAP)
- How can I use goto statement in JavaScript?
- Why C/C++ variables doesn’t start with numbers
- goto statement in C/C++
- Why does C++ require a cast for malloc() but C doesn't?
- Why can't girls have all the fun?
- Can we have a return statement in a JavaScript switch statement?
- C program to explain the goto statement
Advertisements