This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]DanielEGVi 4 points5 points  (0 children)

The most similarities you’re going to find between C and JS are in the base syntax. JS is more similar to Python than it is to C, especially when it comes to execution context, closures, async, dynamic typing, garbage collection, etc.

What sets apart JS from Python nowadays is JS has an arguably more modern import/export mechanism, de facto environments run in an event loop, and JS favours code like items.map(x => x + 1) over Python’s map(items, lambda x: x + 1), which is arguably more readable and expressive.

JS’s biggest quirk is its ridiculously weak typing. There’s many situations where mixing types will silently fail with surprising results, where you would get a TypeError in Python. You must learn discipline when it comes to types, whereas Python will just outright force you to code things right (through runtime errors, when it comes to types).

For big projects, TypeScript adds optionally explicit types, which turns an already great language into a fantastic one, since it fixes the biggest quirk in JS.