Jump to content

Should reserved words be renamed / deprecated?


Recommended Posts

2 hours ago, jerome said:

mmmh... in our case continue() is just a method of a Curve3 instance, so something like that : curve1.continue(curve2);

This is nothing to do with the js statement : continue;

I know, but the page I linked lists it as reserved, and says "In JavaScript, some identifiers are reserved words and cannot be used as variables or function names."

Link to comment
Share on other sites

JavaScript Objects, Properties, and Methods

You should also avoid using the name of JavaScript built-in objects, properties, and methods:

Array Date eval function hasOwnProperty
Infinity isFinite isNaN isPrototypeOf length
Math NaN name Number Object
prototype String toString undefined valueOf
Link to comment
Share on other sites

Reserved words in JS are only illegal to use as identifiers for local vars and functions. Object properties can be named pretty much anything.

myobj.for = 1
myobj.var = 2
myobj.new = 3
myobj.break = 4
myobj.continue = 5

All perfectly fine. Even the words in Jerome's post are legal variable names - it's just suggesting they be avoided for clarity's sake.

Long story short, nothing at all to worry about here.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...