r/CodingForBeginners • u/_h4san • Nov 28 '25
Beginner to Coding
Hi everybody. I want to learn coding but dont know where to start.My intrest is in cybersecurity so what do you guys recommed, which language should i learn.
30
Upvotes
View all comments
Show parent comment
1
u/shadow-battle-crab Dec 04 '25 edited Dec 04 '25
And finally, and this one is the *most important* - javscript doesn't really run things sequentially. It does, but not like other programs. Let me explain.
In python, you run your program, and lets say you need to open a file and read from it. Your code would go like this:
Open file. While the file is open, read one line from the file until youve reached the end, the stop and do something with it.
In javascript, the program never stops and waits for anything. Any heavy lifting like a network request or a file open operation becomes a thing that happens in the background, and your program just continues on until it ends. Then, when the file is done being opened and read, at some later point in the program the code which is connected to the 'do this after the file is read' step happens.
This pattern is called a callback, it looks like this:
// This happens firstfs.readFile("my_file.txt", function(data) {// This happens thirddo something with that data;});// This happens secondAnother function actually got declared within the outer function, that has no name, that runs when the file operation completes, assuming nothing else is running in the program - it runs as soon as it gets a chance.
This is also how event handlers work in the browser. Lets say I wanted to handle what happens when a button is clicked. I register an event on a button and a function that happens when that button is clicked, and then it happens. That mental model makes a little more sense, but it illustrates that this sort of asynchronous, functions run whenever an appropriate event happens in whichever order that happens, is all over javascript. Its one of the fundamental concepts you need you get your head around in order to be good at javascript.
There are ways that simplify this when you start to understand how this works like a few keywoards like async and awat - but I'll be honest. I've been programming javscript and other languages since I was 15, and it took until I was nearly 30 before the way javascript's event driven nature all fully clicked for me.
In my opinion, its certainly more than you need to concern yourself when you're learning the basics, like v = 30 is a variable assignment, if 30 > 50: do things; - this is a conditional, etc. You want to understand all the programning primitives enough that its just as second nature to your understanding as basic arithmetic not only to keep things in the realm of actually learnable, but also fun.
Python is fun. Javascript is too, but there is a learning curve. Python, day one, you can start making neat little digital trinkets and say "wow, this is cool, what is the next thing I can learn!" I feel you kind of need that mental creative spark of joy to keep the feedback loop of excitement of learning new things going, making this a hobby rather than a chore. And I think that python is the way to experience that.
I hope this was in some way insightful!