DEV Community

Tomasz Łakomy
Tomasz Łakomy

Posted on Edited on

In your opinion, what is the most confusing part of JavaScript?

Top comments (14)

Collapse
 
xngwng profile image
Xing Wang •

this

Collapse
 
mattsparks profile image
Matt Sparks •

When I started writing JS it was hard to get an understanding of what prototype is and how it's used.

Collapse
 
karataev profile image
Eugene Karataev •

Type coercion is definitely not obvious in JavaScript

[] == ![] // true 😱
Collapse
 
kenbellows profile image
Ken Bellows •

IMHO, don't ever ever ever use == in JavaScript. Always use === instead and forget about type coercion; just explicitly type-cast anything you need to.

Collapse
 
karataev profile image
Eugene Karataev •

It's a very rare case when you work on a project alone. Other developers can use == and it's necessary to understand how type coercion works.

I agree that most of developers consider == as evil. But Kyle Simpson (You don't know JS author) don't hate type coercion. Moreover, he recomments to use == where necessary.

In other words, coercion, especially implicit coercion, has usages where it actually improves the readability of our code.

Source.

Collapse
 
jckuhl profile image
Jonathan Kuhl •

Closures. It's a complicated subject involving an understanding of how the execution context works and how variables are scoped and held within the JavaScript engine. It takes a lot of practice and theory for closures to finally click. It took me like six months to finally grok it.

Collapse
 
laurieontech profile image
Laurie •

Javascript has a lot of layers. Understanding what is controlling each piece can be hard to parse if you're new. I actually wrote something on this a while back.

Collapse
 
chudesnov profile image
Alexander Chudesnov •

How come they didn't actually go with 'smoosh'?

Collapse
 
k88manish profile image
Manish Kumar •

typeOf null = 'Object'

Collapse
 
koehr profile image
Norman •

Newest confusion is parseInt. Just try and see what happens if you do parseInt(0.000000347)

Collapse
 
jsgoose profile image
Jonathan Sexton •

I have a few things that I considered confusing when I started learning JS..scope, hoisting, closures, callbacks

Collapse
 
phallstrom profile image
Philip Hallstrom •

The ecosystem. Every time I come back to JS the tooling is entirely different. Makes it frustrating to get things done.