; really required after each method?

Why does nobody put a ; behind the i++? Shouldn't it also have one?

for(var i=0; i<someArray.length; i++){}
No, the for loop is defined in the spec http://www.ecma-international.org/ecma-262/5.1/#sec-12.6.3 as for ( ExpressionNoInopt ; Expressionopt ; Expressionopt ) Statement
I know it's just a variable asignment in Javascript. But to me it's a method declaration and method declarations imo should not have semi-colons at the end.

Scene_MiniMap.prototype.initialize = function() { Scene_MenuBase.prototype.initialize.call(this); // << this one okay}; // << this one... Feels wrong. But if I leave it out, it could maybe in theory someday be interpreted wrongly...Damnit so I should put them behind every method as well then..
The automatic semicolon insertion rather means that the following structure should be avoided

Scene_MiniMap.prototype.initialize = function(){    Scene_MenuBase.prototype.initialize.call(this); // << this one okay}
Try playing around with this piece of code

Scene_MiniMap.prototype.playerCoords = function(){    return    {       "x": 2,       "y": 6    };}
Then compare it to this;

Scene_MiniMap.prototype.playerCoords = function(){    return {       "x": 2,       "y": 6    };}
*hugs*

 - Zeriab
i am so use to semicolons that not seeing one would make me say "code smell"
The automatic semicolon insertion rather means that the following structure should be avoided

Try playing around with this piece of code

Scene_MiniMap.prototype.playerCoords = function(){    return    {       "x": 2,       "y": 6    };}Then compare it to this;

Scene_MiniMap.prototype.playerCoords = function(){    return {       "x": 2,       "y": 6    };}*hugs*

 - Zeriab
Ugh I just had that. I only see it now 🙁 . Made another topic for no reason. Anyway, I really dislike all those scripting languages. All so full of weird stuff and not strict enough. And I used to think that C# had some weird stuff. But the stuff I see in most scripting languages... Blergh

Honestly I stlil don't know how to write Javascript code lol. I just use my knowledge from other scripting languages. So far it works pretty well. Just these few weird things now and then that just... I have no words for...
do "use strict" and youll see how strict this "scripting language" can get.
I know it's just a variable asignment in Javascript. But to me it's a method declaration and method declarations imo should not have semi-colons at the end.

Scene_MiniMap.prototype.initialize = function() { Scene_MenuBase.prototype.initialize.call(this); // << this one okay}; // << this one... Feels wrong. But if I leave it out, it could maybe in theory someday be interpreted wrongly...Damnit so I should put them behind every method as well then..
Functions are first-class objects in Javascript, so you're not just declaring a method, you're also assigning it to a variable.

So yes, if you were *only* defining a method, then I wouldn't add a semi-colon...

I don't think it would be problematic if I omitted semi-colons in functions like these

Code:
function myFunc() {  return 1;}
But this is a different story
Code:
myFunct = function() {  return 1;};
@Tsukihime

Yes I know the variable-assignment is the difference. But creating functions by assigning new objects to variables already feels wrong to me. I mean I can live with it all, I will add semicolons to them. But it just feels wrong somehow. But that's just personal I guess.

do "use strict" and youll see how strict this "scripting language" can get.
Impossible, Javascript will still not tell me when: I missed a semicolon, I misspelled a variable name or when my string ends up as NaN because of an undefined value somewhere 'far away'...

It will never be strict because JS simply is not strict. You can't expect the programmer to be strict, that would defeat the whole purpose of a strict language I think. Like blaming the coders for making the mistake of writing "folderpath" instead of "folderPath" and then ending up with an undefined value in some function many iterations later on the stack. I always love languages that just crash the moment I use an undeclared variable or forget a semicolon.

But yes I will add semicolons all over the place now 😀
thats because strict doesn't care about semicolons. It does care about you doing x = y when you should be doing var x =y amount other things.
@Tsukihime

Yes I know the variable-assignment is the difference. But creating functions by assigning new objects to variables already feels wrong to me. I mean I can live with it all, I will add semicolons to them. But it just feels wrong somehow. But that's just personal I guess.

Impossible, Javascript will still not tell me when: I missed a semicolon, I misspelled a variable name or when my string ends up as NaN because of an undefined value somewhere 'far away'...

It will never be strict because JS simply is not strict. You can't expect the programmer to be strict, that would defeat the whole purpose of a strict language I think. Like blaming the coders for making the mistake of writing "folderpath" instead of "folderPath" and then ending up with an undefined value in some function many iterations later on the stack. I always love languages that just crash the moment I use an undeclared variable or forget a semicolon.

But yes I will add semicolons all over the place now 😀
As someone who's predominantly a C++ and Java developer, I feel you.  If you think that feels wrong, it feels even worse when you overwrite a built-in method with your own version.  (That's incredibly against proper design principles in industry languages.)  It also feels incredibly wrong explicitly assigning to the "this" parameter of another function when binding/calling it.  That being stated, both have actually been incredibly useful for plugin development.

And yeah, it'd be nice to have a "strict" mode in Javascript, to be sure.
I just found this: http://www.w3schools.com/js/js_strict.asp

So there is a strict mode.. It works but sadly it doesn't crash. But atleast it shows an error in the console. And this strict-mode is still limited but better than nothing.

Original thread: https://forums.rpgmakerweb.com/threads/really-required-after-each-method.51137/