In this sample line of menu_data.js...
aI("text=some text;url=http://a url goes here;")
Should there be a semi-colon after the closing parenthesis or not? Even the sample menus included are inconsistent in this regard. Some have a semi-colon at the very end after that parenthesis, some don't.
Seems to work either way, but I don't want any surprises.
semi-colon consistency
I'm not up on when you 'can' and when you 'must' use a semi-colon in js, however, I would suggest, since the majority of them have semi-colons, that you use them after the closing bracket of an aI string. I do since that is how they all were in the beginning and I know that they work that way in all the browsers I tested. As you said, I have no surprises that way
Ruth

Ruth
Hi,
With JavaScript the semi-colon is not mandatory, that's why sometimes it's there sometimes not.
However, the semi-colon does indicate end of code line so if you wanted to put your code on one line, you would need to semi-colon.
So this:
Is the same as
Hope this helps,
Andy
With JavaScript the semi-colon is not mandatory, that's why sometimes it's there sometimes not.
However, the semi-colon does indicate end of code line so if you wanted to put your code on one line, you would need to semi-colon.
So this:
Code: Select all
var a=10
var b=123
Code: Select all
var a=10;var b=123
Andy
No worries, also note that scripts like Perl and PHP DO need the quotes, otherwise you get a runtime error.Thanks, Andy
Useful for when you start coding some awesome stuff in PHP. Also, the syntax of PHP is very similar to that of JavaScript - It's all based on the C programming language.
Oh, and somebody asked why variable names have lower case and upper case mixes.
Well, the technical terms for this is camelCase - I use it because it looks a lot neater than camel_case but it's all personal preference.
Here's something about programing in C#:
There's a .net framework recommendation that relates to the accessibility of class members.
1. Identifiers that are public should start with a capital letter. For example, Area starts with A and not a because it's public. This system is known as PascalCase (another programming language) naming scheme.
2. Identifiers that are not public (which include local variables) should start with a lowercase letter. For example, radius starts with r, not R bacause it's private. This is know as camelCase.
It's not that important in JavaScript so everything is in camelCase to make life easier.
Hope I havn't confused you too much,
Andy
Last edited by Andy on Mon Jun 27, 2005 4:15 pm, edited 2 times in total.
Just to add to the mix from the guy lurking out in left field, while not mandatory, as Andy said, we'd really like to see (taking from your example)...
...simply for consistency.
Code: Select all
aI("text=some text;url=http://a url goes here;");
aI("text=some more text;url=http://another url goes here;");
etc.
John