Can anybody help me in understanding the use of goto , label etc in javascript, I have a program where I need to jump directly to a particular block of code...I am trying to use "break labelName" , but its showing an error that "labelName not found". Is there any rule to use label with break or continue Thanks in advance .
Asked
Active
Viewed 2,021 times
1 Answers
0
You must be new to javaScript ;)
Anyhow: defining a function is defining your named excess point:
function doSomething(someVariable){
alert(someVariable);
}
So, somewhere else in your code you can now call doSomething('Hello world!');
Calling the function as above is the GOTO
part and doSomething
correlates to LABEL
. As you see you can also pass some parameters (here it's someVariable
) to the function (the executing code block) and work with it (like here the alert
that causes an alert box showing in your browser showing the assigned value 'Hello world!'.
Maybe this also helps you: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function or http://www.w3schools.com/js/js_functions.asp

jsmorph
- 221
- 1
- 5
-
Yes, I am new to js :)....I know about functions but I just want to know how to use label with break or continue etc... – user2702482 Sep 08 '13 at 15:49