4 ms·
This doesn't apply to newbies who don't know other languages, but since you know python and java, there are two things that got tricky for me with JS as a langu
by projectramo 8y ago
This doesn't apply to newbies who don't know other languages, but since you know python and java, there are two things that got tricky for me with JS as a language.
1. Learn about execution contexts early, and how returning functions is a trick.
2. The history of JS is the history of trying to get around single threaded nature. So there are callbacks and promises and other constructs. Learn about them.
- WorldMaker 8y agoRe: 2: The history of language in general has included a lot of detours dealing with asynchronous programming. Python, which the OP mentions as familiar, has an almost even more convoluted history of asynchronous programming patterns than JS. Both languages have settled on the async/await keywords for the most part these days, and the underlying components are relatively similar, though Python's coroutines are a little more complicated/hands-on than JS Promises. On this subject, I highly recommend finding an environment that lets you use async/await patterns today. It makes working with Promises a lot easier/cleaner, and also makes you aware of why Promises are so great and the remaining other options such as callbacks should be wrapped with Promises then otherwise forgotten. Babel has transpilation options for it, but personally I'm strongly in favor of Typescript.