DEV Community

loading...

What is the most confusing đŸ’¡thing in JavaScript?

sait profile image Sai gowtham ăƒ»1 min read

Discussion (12)

pic
Editor guide
Collapse
elmuerte profile image
Collapse
ben profile image
Ben Halpern
Collapse
ben profile image
Ben Halpern

The most confusing part for me by far is determine whether some style of doing things is still the right way. Change is confusing.

Collapse
briankephart profile image
Brian Kephart

Return statements.

I write more Ruby than JavaScript. In Ruby, every expression returns an object, so explicit return statements are rarely used. In JavaScript, I always forget to explicitly return something from a function.

This by itself isn't really confusing, but then I get confused between:

return something()

and:

return function () {
  something()
}

Something about the scoping of function calls still hasn't clicked for me yet in JS, so I always end up trying a variety of return statements until the code executes as intended. This would probably all make perfect sense if I wrote JS more often, but as an occasional dabbler this is what eats up my time.

Collapse
oninross profile image
Nino Ross Rodriguez

Having markup and css in JS

Collapse
math2001 profile image
Mathieu PATUREL

How so much effort can be put into such a sh*t language.

People don't like JavaScript, they like what they can do with JavaScript. And the only reason that's a lot is because it is required to know JS if you want to make a web page (pretty much). So, most people know JS, therefore more stuff get created in JS, therefore we are stuck with it for even longer.

Just the fact that you have programming languages like Coffeescript shows that JS in itself sucks.

JavaScript sucks

But, don't get me wrong, what you can with JavaScript is absolutely awesome.

Collapse
sait profile image
Sai gowtham Author

Don't learn it by reading learn it by practicing

Collapse
pimterry profile image
Tim Perry

The rate of change.

Tech decisions seem to frequently feel perfect today, but totally wrong a year from now, in a way I've never seen elsewhere. Rapid evolution is great, but exhausting...

Collapse
pbouillon profile image
Pierre Bouillon

I saw this on reddit, don't know if it's true but it made me laugh

Rddit_img

Collapse
math2001 profile image
Mathieu PATUREL

It is true. Just tested it myself:

JavaScript parseInt.

Paste this in the console and see it for yourself:

console.log(parseInt(0.000001))
console.log(parseInt(0.0000001))
console.log(parseInt(0.000006))
console.log(parseInt(0.0000006))
Collapse
yorodm profile image
Yoandy Rodriguez Martinez

That you can't even tell which ESXXX version you're using by looking at the code