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 8599595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:25:51+00:00 2026-06-12T01:25:51+00:00

According to this page https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Reserved_Words You can’t use these reserved words as variables, but

  • 0

According to this page https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Reserved_Words

You can’t use these reserved words as variables, but can you use them this way apperantly:

var test = {
    break : 'whatever',
    case : 'whatever',
    if : 'whatever',
    in : 'whatever'
    //etc
};

I have a fiddle here with all the values http://jsfiddle.net/9RQ9j/4/

And I get no errors either defining them or calling for instance like this

console.log(test.if)

So to me it seems possible, but is it in conflict with the javascript spec? Then it seems at least like all the browsers I have tested in (which are most) do violate the spec and allow you to use those words.

(UPDATE: seems to fail in IE 8 + possibly other IE’s)

And is it even good practice?

Last question: Is this ok?

var test = {
    'break' : 'whatever',
    'case' : 'whatever',
    'if' : 'whatever',
    'in' : 'whatever'
};
  • 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-12T01:25:52+00:00Added an answer on June 12, 2026 at 1:25 am

    According to the ES5 Spec, object properties are IdentifierNames, not Identifiers, which means that they do not exclude reserved words.

    Is it good practice? Probably not in general, but if it makes your code clearer, then yes.

    And yes, referencing properties with a quoted string is equivalent to referencing them with the same unquoted symbol — but the set of identifiers that you can use quoted is obviously larger than those you can use unquoted.

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

Sidebar

Related Questions

According to this: http://developers.facebook.com/docs/reference/api/batch , there's a way to use results of first query
ANY DOM element can be made resizable according to this page: http://jqueryui.com/demos/resizable/ However, it
I didnt find anything according this issue. Can jaas be used to secure my
According to this post in Recursive Descent vs. LALR , any LALR(k) can be
If you look on this page https://foursquare.com/griekenlandnet you will see there are 55 tips
I am trying to create a non-expiring page token that I can use on
According to microsoft, IE8 and IE9 support the :after selector. I use this selector
According to this page http://www.eecs.harvard.edu/~cduan/technical/git/git-1.shtml A commit object contains three things: A set of
I am using Codeigniter 1.7.2 and HMVC (https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home). I have these files and they
According to Google this can be accomplished by visiting "chrome-devtools://devtools/devtools.html" in Chrome but now

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.