Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8590731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:21:40+00:00 2026-06-11T23:21:40+00:00

So, as you may know, the strict mode of JavaScript adds restrictions on the

  • 0

So, as you may know, the strict mode of JavaScript adds restrictions on the identifiers eval, and arguments, effectively making them reserved words, with two exceptions:

  • they can still be uses as expressions, i.e. in places where an expression is expected (with a couple of exceptions, though),
  • they can still be used as label names, and in break/continue statements to reference labels.

Now, I understand the first bullet. If, for instance, the identifier eval wasn’t allowed as an expression (and true reserved words aren’t), we wouldn’t be able to invoke the eval function at all (since eval(str) is an expression). Same goes for arguments – we need to be able to use it as an expression in order to be able to access its elements (e.g. arguments[0]).

This rule has a three exceptions, though. eval/arguments may not appear (1) as left-hand side expressions in assignments (e.g. eval = true;), (2) as operands of ++/-- (e.g. eval++), (3) as operands of delete (e.g. delete eval). Those are the only exceptions though, and in all other expression-contexts, they are valid.

What I don’t understand is the second bullet. Why can they be still used as label names? For instance, this code is valid even in strict mode:

eval: for ( var i = 0; i < 10; i++ ) {
    arguments: for ( var j = 0; j < 10; j++ ) {
        if ( i < j ) continue eval;
        console.log( i - j );    
    }        
}

Notice how continue eval; references the eval label, and has nothing to do with the actual eval function.

Also, notice how true reserved words cannot be used as label names. From my understanding, the intend of strict mode was to make the names eval, and arguments as reserved-word-like as possible. Then why keep them as valid label names?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:21:41+00:00Added an answer on June 11, 2026 at 11:21 pm

    I don’t know why, but I can hazard a pretty good guess.

    The reason eval and arguments are restricted for variable names (and, for that matter, why with is forbidden) is that they affect where variable names bind (i.e. to a local variable, a variable in an enclosing scope, or to a property on the global object if one exists). Without those restrictions, some names are unbound until runtime, with all the hazards that implies.

    Label names occupy a different naming space from variable names, property names, and so on. There’s never ambiguity about the target of a break/continue, because labels are statically assigned and label references are statically resolved. (Yes, eval code can include labels. But existing jumps can’t target those labels, nor can jumps in eval code target pre-existing labels, because label resolution occurs at compile time, and it is scoped to a Program, to use the ECMAScript terminal’s name. A script that contains an eval call is a Program, and the code executed by the eval call is a Program, but the two are entirely separate for label-targeting purposes.)

    The reason to forbid eval and arguments for variable names simply doesn’t apply to labels. Therefore, labels can still be named eval or arguments. It would be stupid to name a label that way, true. And if someone were designing ECMAScript/JavaScript again, they’d be keywords, and not usable as label names. But there’s no gain to be had from forbidding them as label names, and at least a small compatibility argument for not forbidding them, so they were not forbidden.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As you may know, when we have this code in Javascript : function getName()
You may know this recommendation from Microsoft about the use of exceptions in .NET:
You may know the scriptaculous SlideUp effect . Well, It slides up a div
So as you may know, arrays in C# implement IList<T> , among other interfaces.
As you may know, Silverlight 3 doesn't support IMultiValueConverter and... I badly need it.
As some of you may know, use of the LIMIT keyword in MySQL does
As some of you may know in python2.7/3.2 we'll get OrderedDict with PEP372 however
As you may know, in many occasions, there is a need to flag some
Some of you may know the method in Ruby that allows you to reverse
If you've used javadoc and then come to doxygen, you may know what I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.