A step by step tutorial teaching you how to create your own chat client and chat server easily in C#, for local networks or the Internet.
A C# tutorial showing you how to make use of WMI to extract information on disk drives, such as model, capacity, sectors and serial number.
This tutorial will teach you how to calculate the shipping cost based on the weight, height, length and depth of the box, the distance and the UPS service type.
Creating a Rich Text Editor using JavaScript is easier to do than you might think, thanks to the support of modern browsers; this tutorial will walk you through it.
JavaScript identifiersYou will learn the meaning of identifiers and basic rules. It's good to know before you start to learn variables. |
On Monday, March 8th 2004 at 10:43 AM By Andrew Pociu (View Profile) ![]() ![]() ![]() ![]() (Rated 4.4 with 14 votes) |
||
|
Contextual Ads
More JavaScript Resources
Advertisement
Yet, this is another fragment of the book I started to write some time ago, named 'JavaScript class'. This section covers some basic information about JavaScript and also applies to other programming languages... a bit. What are identifiersAn identifier is a symbol that represents, names a piece of data. An identifier can represent a function or a variable, for example. There are some rules regarding the identifiers. Identifiers rulesWe settled that identifiers are names that represent pieces of data. You name your own identifiers, in fact that’s the most important thing regarding identifiers. But you must respect some rules when you name your own variables: Your identifiers must start with a letter, or with the underscore sign ‘_’. You cannot start an identifier with a digit, or with some other sign like $, %, @, etc. But after the first character in your identifier, you can use digits to build your identifier name. You cannot use space in your identifiers. If you must specify two or more words in an identifier, you can use the underscore sign or capitalize the second word, like this:
Therefore be very careful when you choose your identifier name, if you break the rules, the browser will most probably throw a hard to debug error. There is one more thing you must be aware of – the reserved identifiers. Reserved identifiersJavaScript has some predestinated identifiers, and of course, you can’t use the name of those identifiers to specify your own, because it will be confusing for you and your browser. And identifiers represent variables, functions… so I think it’s clear to you that you can’t use these names for them either. This is the list of reserved words: abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends false final finally float for function goto if implements import in instanceof int interface long native new null package private protected public return short static super switch synchronized this throw throws transient true try typeof var void volatile while with Case sensitivityAll JavaScript identifiers are case sensitive. That means that SomeWord, someword, Someword, someWord and SoMeWoRd are different identifiers. You can make use for case sensitivity, and specify more variables, for example, that sound the same, but are written different. But you’ll find that confusing for you. |
|||
Digg It!
Del.icio.us
Reddit
StumbleIt
Newsvine
Furl
BlinkList
|
|||
|
|||
Current CommentsThe naming scheme is incorrect. You do not have to have two words to assign an identifier. But it is better form to do so. Also, the first letter does not need to be capitalized.
myVar is correct
thisMessage is also correct
ThisMessage is equally correct
The tutorial doesn't say you need two words to assign an identifier.
The $ is allowed as the first character.
Related Tutorials
Related Source Code
JavaScript Job Search