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

  • Home
  • SEARCH
  • 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 7617523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:10:17+00:00 2026-05-31T03:10:17+00:00

http://jsbin.com/ifabem/2/edit use strict; window.x = Hello World; alert(x); // this does’t throw an exception

  • 0

http://jsbin.com/ifabem/2/edit

"use strict";

window.x = "Hello World";
alert(x); // this does't throw an exception in strict mode

Why doesn’t accessing x directly in the last statement violate strict mode and throw an exception?

Is it the case that a violating is only writing a new value into the global object, but reading and even modifying an existing object allowed?

  • 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-05-31T03:10:19+00:00Added an answer on May 31, 2026 at 3:10 am

    The phrase “gaining access to the global object” does not occur in the spec, so doesn’t have a clear definition; but looking through Appendix C of the spec (a non-normative listing of the effects of strict-mode), the only restriction that I think could be described that way is this one:

    Assignment to an undeclared identifier or otherwise unresolvable reference does not create a property in the global object. When a simple assignment occurs within strict mode code, its LeftHandSide must not evaluate to an unresolvable Reference. If it does a ReferenceError exception is thrown (8.7.2).

    So you’re not allowed to add a property to the global object without using var or window. or whatnot, but there’s nothing to stop you from getting a property of the global object — or even setting the value of an existing property.

    (By the way, the relevant bit of §8.7.2 is not terribly meaningful out-of-context, but for completeness’ sake, it’s this:

    3. If IsUnresolvableReference(V), then
        a. If IsStrictReference(V) is true, then
            i. Throw ReferenceError exception.
        b. Call the [[Put]] internal method of the global object, passing
            GetReferencedName(V) for the property name, W for the value,
            and false for the Throw flag.

    )

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

Sidebar

Related Questions

http://jsbin.com/ofudi4/3/edit What this code does you can test for yourselves. Now my question is
Code as reference: http://jsbin.com/aboca3/2/edit In this example above (thank you SLaks) I am truncating
EDIT: See this in action here: http://jsbin.com/emobi/5 -- and that's using mouseenter/mouseleave. I have
Edit: I put this snippet of code in jsbin: http://jsbin.com/eneru I am trying to
http://jsbin.com/emoba5/3/edit click here to view demo Does anybody know how to make the image
This is the code http://jsbin.com/opevow/64/edit You can edit it and press top left corner
http://jsbin.com/ofojis/edit#preview http://jsbin.com/ofojis/edit#source Why is the top border of this inline element not displaying? Adding
http://jsbin.com/idazeg/edit#javascript,html Can someone tell me how and why this is working? $('#pp').click (function ()
In this example: http://jsbin.com/anoyik/edit#preview http://jsbin.com/anoyik/edit#source How can I set the red box's width to
Please see this: http://jsbin.com/igeqa here, i am simply using alert ( tableObj.childNodes.length ); and

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.