Aptana complaining about JavaScript semicolonsHow to validate an email address in JavaScript?How do JavaScript closures work?What is the most efficient way to deep clone an object in JavaScript?How do I remove a property from a JavaScript object?Which equals operator (== vs ===) should be used in JavaScript comparisons?How do I include a JavaScript file in another JavaScript file?What does “use strict” do in JavaScript, and what is the reasoning behind it?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?
How can one's career as a reviewer be ended?
A word that means "blending into a community too much"
How to communicate to my GM that not being allowed to use stealth isn't fun for me?
What would be the way to say "just saying" in German? (Not the literal translation)
How can I use String in enum for Apex?
Smart-expansion of a range to a list of numbers
How can I make 12 tone and atonal melodies sound interesting?
Reactive Programming
What does 思ってやっている mean?
Should I put programming books I wrote a few years ago on my resume?
Printing Pascal’s triangle for n number of rows in Python
Who won a Game of Bar Dice?
Live action TV show where High school Kids go into the virtual world and have to clear levels
What aircraft was used as Air Force One for the flight between Southampton and Shannon?
A map of non-pathological topology?
Which is the better way to call a method that is only available to one class that implements an interface but not the other one?
Increase speed altering column on large table to NON NULL
Solve Riddle With Algebra
USGS Relief map (GeoTIFF raster) misaligns with vector layers (QGIS)
Next date with distinct digits
bash does not know the letter 'p'
Is an entry level DSLR going to shoot nice portrait pictures?
Can I utilise a baking stone to make crepes?
Is it expected that a reader will skip parts of what you write?
Aptana complaining about JavaScript semicolons
How to validate an email address in JavaScript?How do JavaScript closures work?What is the most efficient way to deep clone an object in JavaScript?How do I remove a property from a JavaScript object?Which equals operator (== vs ===) should be used in JavaScript comparisons?How do I include a JavaScript file in another JavaScript file?What does “use strict” do in JavaScript, and what is the reasoning behind it?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Why does Aptana with either validator (Mozilla or JSlint) complain about this code:
var collectionOfValues =
key0 : value0;
key1 : value1;
key2 : value2;
;
It works fine with ,
but not with ;
.
Even code from The Good Parts won't validate:
var myObject =
value: 0;
increment: function (inc)
this.value += typeof inc === 'number' ? inc : 1;
;
javascript validation aptana
add a comment |
Why does Aptana with either validator (Mozilla or JSlint) complain about this code:
var collectionOfValues =
key0 : value0;
key1 : value1;
key2 : value2;
;
It works fine with ,
but not with ;
.
Even code from The Good Parts won't validate:
var myObject =
value: 0;
increment: function (inc)
this.value += typeof inc === 'number' ? inc : 1;
;
javascript validation aptana
add a comment |
Why does Aptana with either validator (Mozilla or JSlint) complain about this code:
var collectionOfValues =
key0 : value0;
key1 : value1;
key2 : value2;
;
It works fine with ,
but not with ;
.
Even code from The Good Parts won't validate:
var myObject =
value: 0;
increment: function (inc)
this.value += typeof inc === 'number' ? inc : 1;
;
javascript validation aptana
Why does Aptana with either validator (Mozilla or JSlint) complain about this code:
var collectionOfValues =
key0 : value0;
key1 : value1;
key2 : value2;
;
It works fine with ,
but not with ;
.
Even code from The Good Parts won't validate:
var myObject =
value: 0;
increment: function (inc)
this.value += typeof inc === 'number' ? inc : 1;
;
javascript validation aptana
javascript validation aptana
edited Mar 24 at 19:56
Jonathan Leffler
582k966961052
582k966961052
asked Jul 25 '11 at 21:05
Jason DoucetteJason Doucette
1081314
1081314
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
It's complaining because that's a syntax error. In an object literal, you separate terms with commas, not semicolons.
var collectionOfValues =
key0 : value0,
key1 : value1,
key2 : value2
;
Both your examples would be rejected by every JavaScript implementation I know of.
var myObject =
value: 0,
increment: function (inc)
this.value += typeof inc === 'number' ? inc : 1;
;
This has been the case essentially since the Big Bang.
Great, thank you for the confirmation. Just very strange that the code within JavaScript - The Good Parts is wrong, and the documentation for a new API that mentions using JSLint for validation is also wrong, in the same way. It seemed like if they were both saying ; were ok then maybe they really were ok.
– Jason Doucette
Aug 4 '11 at 5:18
add a comment |
because proper syntax would be
var collectionOfValues =
key0 : value0,
key1 : value1,
key2 : value2,
;
for a js object
4
the , after value2 is not valid
– Bastian
Jul 25 '11 at 21:10
sue it is :P it'll run. It's not a good practice, but it'll run. I purposefully left it in there as a juxtaposed to the original, highlighting the one thing that when changed made a difference.
– Joseph Marikle
Jul 25 '11 at 21:21
1
@Joseph actually IE6 won't be able to run that enterprisedojo.com/2010/12/19/…
– Greg Guida
Jul 25 '11 at 21:30
lol thanks for the link, Greg. XD I didn't know (but probably should have guessed) that IE would have an issue with it.
– Joseph Marikle
Jul 25 '11 at 21:32
Thanks for the information. I know in C# that arrays can have the trailing comma, and I never knew why, until I started having to modify arrays in code a lot, and that trailing comma sure comes in handy, since you can just add it, and then modify line-by-line and not worry about which line is last, since they all have commas. In any case, I wish to code JavaScript the 'right way', so thanks. I wonder if JSLint catches this trailing comma? I would assume so. Actually it doesn't... Hmm. Guess it's ok.
– Jason Doucette
Aug 4 '11 at 5:38
add a comment |
I know that this is a late answer, but The Good Parts is right actually. (The questioner probably knows this, but for anyone else reading this....); my copy is dated 2008 and this post is 2011. It is printed with a comma.
It's the next bit that baffles me... ;-)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f6822340%2faptana-complaining-about-javascript-semicolons%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
It's complaining because that's a syntax error. In an object literal, you separate terms with commas, not semicolons.
var collectionOfValues =
key0 : value0,
key1 : value1,
key2 : value2
;
Both your examples would be rejected by every JavaScript implementation I know of.
var myObject =
value: 0,
increment: function (inc)
this.value += typeof inc === 'number' ? inc : 1;
;
This has been the case essentially since the Big Bang.
Great, thank you for the confirmation. Just very strange that the code within JavaScript - The Good Parts is wrong, and the documentation for a new API that mentions using JSLint for validation is also wrong, in the same way. It seemed like if they were both saying ; were ok then maybe they really were ok.
– Jason Doucette
Aug 4 '11 at 5:18
add a comment |
It's complaining because that's a syntax error. In an object literal, you separate terms with commas, not semicolons.
var collectionOfValues =
key0 : value0,
key1 : value1,
key2 : value2
;
Both your examples would be rejected by every JavaScript implementation I know of.
var myObject =
value: 0,
increment: function (inc)
this.value += typeof inc === 'number' ? inc : 1;
;
This has been the case essentially since the Big Bang.
Great, thank you for the confirmation. Just very strange that the code within JavaScript - The Good Parts is wrong, and the documentation for a new API that mentions using JSLint for validation is also wrong, in the same way. It seemed like if they were both saying ; were ok then maybe they really were ok.
– Jason Doucette
Aug 4 '11 at 5:18
add a comment |
It's complaining because that's a syntax error. In an object literal, you separate terms with commas, not semicolons.
var collectionOfValues =
key0 : value0,
key1 : value1,
key2 : value2
;
Both your examples would be rejected by every JavaScript implementation I know of.
var myObject =
value: 0,
increment: function (inc)
this.value += typeof inc === 'number' ? inc : 1;
;
This has been the case essentially since the Big Bang.
It's complaining because that's a syntax error. In an object literal, you separate terms with commas, not semicolons.
var collectionOfValues =
key0 : value0,
key1 : value1,
key2 : value2
;
Both your examples would be rejected by every JavaScript implementation I know of.
var myObject =
value: 0,
increment: function (inc)
this.value += typeof inc === 'number' ? inc : 1;
;
This has been the case essentially since the Big Bang.
answered Jul 25 '11 at 21:07
PointyPointy
325k47468537
325k47468537
Great, thank you for the confirmation. Just very strange that the code within JavaScript - The Good Parts is wrong, and the documentation for a new API that mentions using JSLint for validation is also wrong, in the same way. It seemed like if they were both saying ; were ok then maybe they really were ok.
– Jason Doucette
Aug 4 '11 at 5:18
add a comment |
Great, thank you for the confirmation. Just very strange that the code within JavaScript - The Good Parts is wrong, and the documentation for a new API that mentions using JSLint for validation is also wrong, in the same way. It seemed like if they were both saying ; were ok then maybe they really were ok.
– Jason Doucette
Aug 4 '11 at 5:18
Great, thank you for the confirmation. Just very strange that the code within JavaScript - The Good Parts is wrong, and the documentation for a new API that mentions using JSLint for validation is also wrong, in the same way. It seemed like if they were both saying ; were ok then maybe they really were ok.
– Jason Doucette
Aug 4 '11 at 5:18
Great, thank you for the confirmation. Just very strange that the code within JavaScript - The Good Parts is wrong, and the documentation for a new API that mentions using JSLint for validation is also wrong, in the same way. It seemed like if they were both saying ; were ok then maybe they really were ok.
– Jason Doucette
Aug 4 '11 at 5:18
add a comment |
because proper syntax would be
var collectionOfValues =
key0 : value0,
key1 : value1,
key2 : value2,
;
for a js object
4
the , after value2 is not valid
– Bastian
Jul 25 '11 at 21:10
sue it is :P it'll run. It's not a good practice, but it'll run. I purposefully left it in there as a juxtaposed to the original, highlighting the one thing that when changed made a difference.
– Joseph Marikle
Jul 25 '11 at 21:21
1
@Joseph actually IE6 won't be able to run that enterprisedojo.com/2010/12/19/…
– Greg Guida
Jul 25 '11 at 21:30
lol thanks for the link, Greg. XD I didn't know (but probably should have guessed) that IE would have an issue with it.
– Joseph Marikle
Jul 25 '11 at 21:32
Thanks for the information. I know in C# that arrays can have the trailing comma, and I never knew why, until I started having to modify arrays in code a lot, and that trailing comma sure comes in handy, since you can just add it, and then modify line-by-line and not worry about which line is last, since they all have commas. In any case, I wish to code JavaScript the 'right way', so thanks. I wonder if JSLint catches this trailing comma? I would assume so. Actually it doesn't... Hmm. Guess it's ok.
– Jason Doucette
Aug 4 '11 at 5:38
add a comment |
because proper syntax would be
var collectionOfValues =
key0 : value0,
key1 : value1,
key2 : value2,
;
for a js object
4
the , after value2 is not valid
– Bastian
Jul 25 '11 at 21:10
sue it is :P it'll run. It's not a good practice, but it'll run. I purposefully left it in there as a juxtaposed to the original, highlighting the one thing that when changed made a difference.
– Joseph Marikle
Jul 25 '11 at 21:21
1
@Joseph actually IE6 won't be able to run that enterprisedojo.com/2010/12/19/…
– Greg Guida
Jul 25 '11 at 21:30
lol thanks for the link, Greg. XD I didn't know (but probably should have guessed) that IE would have an issue with it.
– Joseph Marikle
Jul 25 '11 at 21:32
Thanks for the information. I know in C# that arrays can have the trailing comma, and I never knew why, until I started having to modify arrays in code a lot, and that trailing comma sure comes in handy, since you can just add it, and then modify line-by-line and not worry about which line is last, since they all have commas. In any case, I wish to code JavaScript the 'right way', so thanks. I wonder if JSLint catches this trailing comma? I would assume so. Actually it doesn't... Hmm. Guess it's ok.
– Jason Doucette
Aug 4 '11 at 5:38
add a comment |
because proper syntax would be
var collectionOfValues =
key0 : value0,
key1 : value1,
key2 : value2,
;
for a js object
because proper syntax would be
var collectionOfValues =
key0 : value0,
key1 : value1,
key2 : value2,
;
for a js object
answered Jul 25 '11 at 21:07
Joseph MarikleJoseph Marikle
59.4k1391118
59.4k1391118
4
the , after value2 is not valid
– Bastian
Jul 25 '11 at 21:10
sue it is :P it'll run. It's not a good practice, but it'll run. I purposefully left it in there as a juxtaposed to the original, highlighting the one thing that when changed made a difference.
– Joseph Marikle
Jul 25 '11 at 21:21
1
@Joseph actually IE6 won't be able to run that enterprisedojo.com/2010/12/19/…
– Greg Guida
Jul 25 '11 at 21:30
lol thanks for the link, Greg. XD I didn't know (but probably should have guessed) that IE would have an issue with it.
– Joseph Marikle
Jul 25 '11 at 21:32
Thanks for the information. I know in C# that arrays can have the trailing comma, and I never knew why, until I started having to modify arrays in code a lot, and that trailing comma sure comes in handy, since you can just add it, and then modify line-by-line and not worry about which line is last, since they all have commas. In any case, I wish to code JavaScript the 'right way', so thanks. I wonder if JSLint catches this trailing comma? I would assume so. Actually it doesn't... Hmm. Guess it's ok.
– Jason Doucette
Aug 4 '11 at 5:38
add a comment |
4
the , after value2 is not valid
– Bastian
Jul 25 '11 at 21:10
sue it is :P it'll run. It's not a good practice, but it'll run. I purposefully left it in there as a juxtaposed to the original, highlighting the one thing that when changed made a difference.
– Joseph Marikle
Jul 25 '11 at 21:21
1
@Joseph actually IE6 won't be able to run that enterprisedojo.com/2010/12/19/…
– Greg Guida
Jul 25 '11 at 21:30
lol thanks for the link, Greg. XD I didn't know (but probably should have guessed) that IE would have an issue with it.
– Joseph Marikle
Jul 25 '11 at 21:32
Thanks for the information. I know in C# that arrays can have the trailing comma, and I never knew why, until I started having to modify arrays in code a lot, and that trailing comma sure comes in handy, since you can just add it, and then modify line-by-line and not worry about which line is last, since they all have commas. In any case, I wish to code JavaScript the 'right way', so thanks. I wonder if JSLint catches this trailing comma? I would assume so. Actually it doesn't... Hmm. Guess it's ok.
– Jason Doucette
Aug 4 '11 at 5:38
4
4
the , after value2 is not valid
– Bastian
Jul 25 '11 at 21:10
the , after value2 is not valid
– Bastian
Jul 25 '11 at 21:10
sue it is :P it'll run. It's not a good practice, but it'll run. I purposefully left it in there as a juxtaposed to the original, highlighting the one thing that when changed made a difference.
– Joseph Marikle
Jul 25 '11 at 21:21
sue it is :P it'll run. It's not a good practice, but it'll run. I purposefully left it in there as a juxtaposed to the original, highlighting the one thing that when changed made a difference.
– Joseph Marikle
Jul 25 '11 at 21:21
1
1
@Joseph actually IE6 won't be able to run that enterprisedojo.com/2010/12/19/…
– Greg Guida
Jul 25 '11 at 21:30
@Joseph actually IE6 won't be able to run that enterprisedojo.com/2010/12/19/…
– Greg Guida
Jul 25 '11 at 21:30
lol thanks for the link, Greg. XD I didn't know (but probably should have guessed) that IE would have an issue with it.
– Joseph Marikle
Jul 25 '11 at 21:32
lol thanks for the link, Greg. XD I didn't know (but probably should have guessed) that IE would have an issue with it.
– Joseph Marikle
Jul 25 '11 at 21:32
Thanks for the information. I know in C# that arrays can have the trailing comma, and I never knew why, until I started having to modify arrays in code a lot, and that trailing comma sure comes in handy, since you can just add it, and then modify line-by-line and not worry about which line is last, since they all have commas. In any case, I wish to code JavaScript the 'right way', so thanks. I wonder if JSLint catches this trailing comma? I would assume so. Actually it doesn't... Hmm. Guess it's ok.
– Jason Doucette
Aug 4 '11 at 5:38
Thanks for the information. I know in C# that arrays can have the trailing comma, and I never knew why, until I started having to modify arrays in code a lot, and that trailing comma sure comes in handy, since you can just add it, and then modify line-by-line and not worry about which line is last, since they all have commas. In any case, I wish to code JavaScript the 'right way', so thanks. I wonder if JSLint catches this trailing comma? I would assume so. Actually it doesn't... Hmm. Guess it's ok.
– Jason Doucette
Aug 4 '11 at 5:38
add a comment |
I know that this is a late answer, but The Good Parts is right actually. (The questioner probably knows this, but for anyone else reading this....); my copy is dated 2008 and this post is 2011. It is printed with a comma.
It's the next bit that baffles me... ;-)
add a comment |
I know that this is a late answer, but The Good Parts is right actually. (The questioner probably knows this, but for anyone else reading this....); my copy is dated 2008 and this post is 2011. It is printed with a comma.
It's the next bit that baffles me... ;-)
add a comment |
I know that this is a late answer, but The Good Parts is right actually. (The questioner probably knows this, but for anyone else reading this....); my copy is dated 2008 and this post is 2011. It is printed with a comma.
It's the next bit that baffles me... ;-)
I know that this is a late answer, but The Good Parts is right actually. (The questioner probably knows this, but for anyone else reading this....); my copy is dated 2008 and this post is 2011. It is printed with a comma.
It's the next bit that baffles me... ;-)
answered Jul 5 '13 at 14:37
MaxMax
136
136
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f6822340%2faptana-complaining-about-javascript-semicolons%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown