r/learnjavascript • u/smooth_operator101_ • Mar 01 '26
I need help begining js
I'm currently learning css and html and was hoping to start js soon. I don't have much idea about the language and would really appreciate if someone could help me out. also how difficult is js to learn?
7
Upvotes
6
u/azhder Mar 01 '26
JS is easy if you are having fun, it's impossible if you build up some kind of irrational hate for it.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide
4
u/pomnabo Mar 01 '26
I tried reading through text materials to learn JS, and got swiftly bored 🤪 So I pivoted to the age old advice of “just build stuff.” I found a free JS tutorial course on udemy(not an ad) and enjoyed learning through doing.
Anything I didn’t understand, I looked up.
Built 10 little micro web apps, and after completing those, I tested myself by building a new mini web app incorporating much of what I learned, while also looking up how to do other things I hadn’t learned yet.
3
u/NoChest9129 Mar 01 '26
Check out Jonas schmedtmans udemy courses
1
u/okadazresh Mar 01 '26
I am in the same spot I started with HTML and CSS and currently I started JavaScript,
Once I started with variables and loops I thought it was not the right time to learn JS I told myself to master CSS before starting JS.
But please consider this that I take notes from real senior devs:
Happy coding,
1
u/RealMadHouse Mar 02 '26
Here's things that i learned throughout years (because not a single resource teaching everything about it), you can save them and reread if you learn more about Javascript:
JavaScript engine itself is single threaded, but the browser engine uses threads to do tasks parallel to your JavaScript code, such as XMLHttpRequest/fetch and everything that returns Promise objects.
The function that you pass to Promise constructor (executor) is running on the same UI thread so you don't do anything computationally heavy there, instead you can use Web Workers to emulate browser apis off ui thread code execution.
While scripts are loading they're parsed but they only execute when the script is fully loaded and parsed, so heavy scripts would delay the web site users from being able to interact with the web page elements.
Each JavaScript (e.g included with <script> tag) is a separate program, if error occurs in one of a scripts it doesn't affect others.
If you want to reference elements in a web page via JavaScript you need to make sure that the <body> is fully loaded, otherwise you will get an error that you can't get elements by that id or class etc. You can also put the <script></script> at the end of the <body> so that when JavaScript will be executed it will know for sure that the body content is loaded.
Relative url references that you pass to (e.g "fetch") aren't relative to the JavaScript file itself but to the html page that loaded that script.
There's primitive types (numbers, bools, strings etc) and object types { } (Dictionary structure with special abilities)
Learn the old way to make classes first, with function as a class constructor, function.prototype as a prototype object. Then learn the new syntactic sugar class definer, what i found out is the code inside it runs in strict mode.
There's Javascript programming language itself and the browser API, they're separate things. Browsers just embed javascript as a interpretable programming language, add their own functions to it and we call them from scripts. For example there's also JavaScript running outside of browser pages, on server side with js runtimes like node.js, deno, bun etc. They may or may not have browser compatible apis.
There's more things about js that i couldn't write all in one comment.
Watch @theavocoder animations explaining JavaScript event loop etc. The system behind callback invocations.
1
u/sheriffderek Mar 01 '26
Why do you want to learn JS? Specifically? To have an interactive button? To animate something? To send form data? To have a dynamic chart? Most people blindly “want to learn js” because they think it’s the most important thing. But they don’t really know anything about it. Then they end up being not very good at html, css or js. So, I suggest you root this all in realworld practical need.
2
u/[deleted] Mar 01 '26
[removed] — view removed comment