JavaScript is Hard...from a Python Developer

Опубликовано: 08 Май 2025
на канале: BeGeos Dev
52
2

Python was the first language I learned, and I still think is the best. However, web development is dominated by JavaScript as such, to become a full-stack developer, you need to learn it with all its perks and its pitfalls. I want to tell the top 10 craziest or difficult things I had to learn when switching language, coming from a paradigm like Python, very tidy, precise, lots of rules and standards, to JavaScript which is more chilled with different rules, syntax and paradigm.

It was fun, I had fun. JavaScript is super satisfying and very beginner friendly. But there were some things that were really hard for me to learn, or re-learn, and others that I just don’t understand why, or when or where.

1. Async/Await
Asynchronous code doesn’t exist in Python, it’s not a thing. While in JavaScript it is THE thing. Loading a page would take forever if it wasn’t for async events. Now, it is clear to me why the web is built on top of JavaScript. With the new syntax Async/Await it makes it super-easy, almost resembling sync code. But what really threw me off were Promises. They are interesting objects but unfortunately not all async functions return Promises, and that really was a challenge. You need to “promisify” the return value. But my question remains why would you write async code that doesn’t return a promise?
2. Callbacks
Along the same line as before, callback functions do exist in Python, but for different purposes. The concept makes sense: Hey you function when you are done doing that, run this with its return value. I have 2 problems with this:
• First, the level of nesting of callback function can really get out of hand, FAST…
• Secondly, I have to know what the parent function returns, which in most cases I have no idea, it could return 3 arguments, I would never know because, apparently in JavaScript arguments are not so important.
3. Arguments
Python is tyrannical, lots of rules and even the slightest thing can throw an error. Arguments are one of those slight things. Put 1 arguments when 2 are needed and Python will scold you with a TypeError and back to your room. On the other hand, JavaScript doesn’t really care, 1, 2, 3…no problem. That must be fixed.
4. Prototype
I still haven’t figured out what a prototype is, does or the reason of its existence. Nobody handles objects like Python and in this case, JavaScript is overcomplicating it.
5. For Loops
Python does it super-fast and super easy. However, it’s wrong. This is another case of badly named stuff, like lambda. A For Loop in Python is actually a For Each loop, where you can access the item itself. In JavaScript, the implementation is correct, where you initialise a counter, and with that you point at things.
6. Undefined or Null
Ok, so in Python a blank return from a function is None. In JavaScript is undefined. Great, so None and Undefined are the same thing. What’s null then?
7. Brackets
Good old debate, indentation, or brackets? I prefer indentation.
8. Slicing arrays
List[::-1] in Python reverse an entire list. In JavaScript you must use the slice method, and good luck reversing the array with just that.
9. Truthy & Falsy
There are Boolean True and False, and then there are values that are truthy, evaluate as True, and Falsy, evaluate as False. This is getting weirder. Type is important, a string is a string even if it’s empty!
10. Triple equal
There’s one equal for assignment, everybody gets that. There’s double equal for comparison, ok I follow. And in JavaScript there’s also triple equal because it checks for type equality as well. Really?! That is a true punch in the eye for a Pythonista like me.

Ok, this was my chart and if you relate with some of these, don’t worry, you are not alone. I hope to see you at the next video, make to check out my milestone project series where I develop gradually complicated web apps, next week it’s time for a Twitter Clone, so stay tuned for more,

BeGeos,

Social:
Twitter:   / begeosdev  
GitHub: https://github.com/BeGeos

Timestamps:
00:00 Intro
00:49 Async/Await
2:31 Callbacks
3:37 Arguments
4:30 Prototype
5:13 For Loops
6:25 Undefined or Null
6:55 Brackets
7:37 Slicing arrays
8:28 Truthy & Falsy
9:20 Triple Equal
10:49 Outro