DEV Community

Discussion on: Is JavaScript a hard language to learn? (and other things)

Collapse
 
kspeakman profile image
Kasey Speakman

No, Javascript is not a hard language to learn. It does have some notorious footguns that you would do well to avoid. The biggest one of these being implicit type conversions. For example. Javascript section starts at 1:22. The way it handles implicit casts means you have to care an awful lot about type equivalence. In particular use === to check for equivalence in type and value. Using only double-equal will silently do an implicit cast if the types are different.

Another honorable mention is JS's numeric type. Floating point numbers in particular do not behave like you would hope. Try adding .1 + .2 and you get 0.30000000000000004. If I need a money calculation, I will send it to the server to calculate and show it on the front-end as a string. Or worst case, I will convert the floating point to an integer (multiply by 10s until the integer has enough precision for your calculation), the perform the integer-based calculation, then convert back to a float (divide by 10s).

These are more-or-less avoidable problems.

The thing that IS hard about Javascript (and front-end in general) is its dev ecosystem. There are a lot of moving parts. Best to look for templates or starter packages at first. e.g. Create {Insert view technology} App.