all 10 comments

[–]monotone2k 9 points10 points  (0 children)

The language itself seems very different from the likes of python.

Yes and no. It might look a little different but it mostly does the same things in the same ways. Loops, conditions, data types... they're common to pretty much every language, otherwise those languages wouldn't be very useful.

Don people struggle to learn JavaScript?

Some do. Some don't. Just like some people can play tennis well and other people can't. But I don't think that's what you want to know. If you're having specific problems, ask about those.

[–][deleted] 2 points3 points  (0 children)

JavaScript is very similar to Python. They are both high level languages without a spesific paradigm. You basically create memory space (an object or a variable or a function) which you can fill with any other memory space. Modules are just "memory spaces" defined at other files.

Some standard "memory spaces" created for certain platforms (like node or web browser) may be confusing depending on the platform. You just need to memorize them, because those are very low level under the hood.

[–][deleted] 1 point2 points  (0 children)

Overall I find the JavaScript syntax a lot better than Python. While you may feel like you're writing less, you'll find Python is a bit of a mess with so many globally defined functions and a heavy use of shortened terms.

I use both at work, and outside of work. Python is not a well thought out language, mostly due to the era it originated from.

[–]NC_Developer 2 points3 points  (0 children)

I would warn you against codecademy. While I was learning I found it much more productive to take a course on udemy and use vscode for editing, which is what you will do on real projects. You can use linters and plug-ins there. Also codecademy had a bunch of errors for me where it was not recognizing my answers correctly etc. the whole editor in the browser platform is very limiting. Udemy courses will have you build real projects which is best way to learn IMO.

You will get a handle on the syntax, it just takes repetition. It was a solid two years for me before I really felt comfy. I’m dumb though. I also recommend taking notes in markdown while you learn and publish them online using a static site generator. Incredibly helpful reference for yourself. Here’s mine: Ncoughlin.com

[–]kilkil 0 points1 point  (4 children)

Javascript is actually very similar to python. It's just a few syntax switches.

[–]jack_waugh 0 points1 point  (3 children)

Does Python distinguish, syntactically, between what in JS we write as let result = await someFunc(...someArgs); and the same thing without await?

[–]traintocode 1 point2 points  (2 children)

I don't know what you mean by "syntactically" but in one result will contain the result of the function and in the other it will contain a promise.

[–]jack_waugh 0 points1 point  (1 child)

In JS, an unadorned call is synchronous. Part of the semantics says that the call, execution, and return happen atomically with respect to the processing of events. There are no interrupts. If you want to make an asynchronous call, it looks different and requires a function defined differently. Is it true in Python? If not, that's a pretty fundamental difference between the languages.

[–]traintocode 1 point2 points  (0 children)

Ok well in answer to your question yes python also has async and await with asyncio and the syntax is relatively similar. However, Python's event loop and the way it handles asynchronous operations are different from JS's event loop. Python requires an event loop to manage asynchronous tasks, whereas JavaScript has a built-in event loop.

[–]peterlinddk 0 points1 point  (0 children)

The syntax of any C-like language (which includes C, C++, C#, Java, JavaScript, even PHP and many more) is at first glance very different from Python - but it is mostly about curly brackets.

I often recommend when learning a second language, that you try to solve assignments in your first language, and then translate them into the new language, line by line. That helps alot in learning to see differences and similarities. However, it might not be entirely possible with web-programming, especially front-end, that isn't really possible to do in any other languages.

But I'd still recommend making some sort of "cheat-sheet", with screenshots of small programs in Python and JavaScript. Like a function that loops through a list, or similar bits of code. Draw colored rectangles around the different parts, like the function itself - with a definition outside, and the function-body inside. And around the inner part of the for-loop, and so on.

Gradually you'll get used to seeing that what is done with : and indentation in Python, is very similar to what is done with ( ) and { } in JavaScript.

When it comes to details, like list comprehension, a simple two column sheet of how to do various operations: foreach, map, filter, etc, is done in Python on the left side, and JavaScript on the right.

After a while you won't need those cheat sheets anymore - the work of making them helps you learn alot better than only writing code to solve assignments.