Search code examples
javascriptdevtools

What does the [whatever]:[number] construct mean in the developer console?


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.

enter image description here


Solution

  • 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();