When I was using the developer console in the browser, I accidentally entered a construction like whatewer:42
The console in response output a number after the colon. I don't understand why such a construction is needed. If you use it anywhere else, you get an error.
Asked
Active
Viewed 31 times
2

hheimerd
- 65
- 4
1 Answers
3
If you use it anywhere else, you get an error.
No, you don't. It's a labeled statement.
function test() {
whatever: 42;
console.log('No error');
}
test();

Robby Cornelissen
- 91,784
- 22
- 134
- 156