The most common mistake you made JS

What's the most common mistake when you write JS?

When invoking functions/methods I often forget (). This often drives me nut to debug. This either lead to logic error or configuration does not work.
Same here, but sometimes common typing errors are annoying, too!
Syntax Error: tis is undefined
Syntax Error: thid is undefined
Syntax Error: ths is undefined
Syntax Error: thi is undefined
For me, it is (or at least used to be) not putting a semicolon at the end of lines. But it can vary a lot. My most recent mistake was using an apostrophe in a string. The code counted it as a quotation mark, resulting in an error.
@shockra unless you're using plain notepad to write JS then that happens. if you write JS with IDEs detects most syntax errors. Forget () visual studio code can't detect because it does not understand whether we want to invoke the function or we simply want to reference the function.
Sometimes I forget to define variables before writing them. Or worse, I rename them but don't rename all the places I use it.
Syntax Error: tis is undefined
Syntax Error: thid is undefined
Syntax Error: ths is undefined
Syntax Error: thi is undefined
lool ! 🤣
You must have too big paw
Make you a macro at this point.
afcaefaeg.jpg
Misspelling variable names is probably the most common for me. For example split and spilt or $gameVariables and $gameVariable.
lol for myself it's because I use Typescript wich is js with type and then I return to JS for write....
and I tend to put the type of the parameters of an function like this :
Code:
public static MyFunc(params: number): void {}  // <-- would work in  typescript but not in js lol
@shokra I have never encountered a case where missing a semicolon was a mistake in js. From what I've read, it's mostly necessary when you have two commands on one line. But nothing has ever crashed on me from missing a semicolon.

As for my most common mistake, it's this:
For (i in 10) (frikkin' python...)
if x=10 {
code code code
}
When I copy paste functions from the core files in my plugin, I often forget to change the object name and then I wonder why it didn't change anything :kaosalute:
Well, I don't use Semicolons at all so I never have the problem of forgetting one, I know where to put them if I have to and it's not often. My most common problem is always a typo.
Scene_Something.prototype.someFunction() {}
instead of
Scene_Something.prototype.someFunction = function() {}

Also,
console.log('gold obtained: ' amount)
Mine would be not following the eslint standards I put forward for my scripts and then disabling them when get actually make sense.
Mine are mostly typos or using the wrong variable due to a typo.
I usually forget to use the "this " keyword when calling functions or referencing variables.

This is because I'm used to languages with class scope and isn't required when invoking an objects methods.
Because js has no classes or object scope. 85% of all errors I get are caused by missing this key words.
For me is the ;
i think in english is called: semicolon ?

Logically, the javascript engine will detect when it needs to make a command jump to new command.
But according to my previous experience in webmaster, it becomes a big problem when you decide to compile the project JS in final version.
You logically use a JavaScript Minifier (compressor).
The minimize will cause a lot of error in the compilation if you forget about ( ; ) semicolon
Logically the idea is to make JavaScript more powerful and fast by compiling all into one JS file on one line!
Especially as this makes it hard to hack your code.

So my most common mistakes am do, is forgotten to put this at the end of each command in js ;

Original thread: https://forums.rpgmakerweb.com/threads/the-most-common-mistake-you-made-js.80173/